Validate backup size during restore

Reasons:
 - A user is able to pass a backup that is larger
   than the volume/disk of the instance can handle.

Changes:
 - Add validation to backup size according to volume
   or flavor size of the disk;
 - Add tests.

Change-Id: Id549cff2e572a0ada632759bd9fcbbb67edf6ae0
Closes-Bug: #1304603
Added Replication templates for Percona

There are no templates for Percona replication, so any attempt to create
a replica using the Percona datastore will fail.

The relevant templates have been added.

Change-Id: Ide52bbb3f918caabe7b0a32adaf0ed50e49202be
Closes-Bug: #1386887
Added regression test for config with long value

This bug is fixed by changes from
https://review.openstack.org/#/c/79850

The bug was originally caused by ConfigurationsController._find_type()
only returning an int as the type even for long values.  With the
changes from the above review _find_type() now returns valid types of
int and long.

Added a regression test to validate the scenario described in the bug.

Change-Id: I6df4c919ccccad7481197b8feddaf6f27a5e4e42
Closes-Bug: #1308665
Eliminate use of sudo for two things that don't need it

The MySQL restore strategy used exec_with_root_helper() which was a
skinny wrapper on execute with sudo to find out whether MySQL was up
and running or not. This is unnecessary as any user can run mysqladmin
(by default) and similarly, any user can run ps (not only root).

Since these two code paths were the only ones that used
exec_with_root_helper() I've eliminated that as well. It didn't do
something so profound that its loss will be missed anyway.

Change-Id: Ia0452417b88416b0289f894b99a8632ab0328539
Closes-Bug: #1350075
Deleting failed replication backup can hide error

If there is a problem with getting the replication snapshot, the backup
is deleted. If the delete fails (if, for example, the backup is in the
wrong state) then the original exception is lost (and more importantly,
not logged).

Handling is now in place to trap exceptions while deleting a 'bad'
replication backup. All exceptions are logged and re-thrown as a
TroveError.

The duplicated code around the backup delete has also been collapsed
into one (nested) exception.

Change-Id: I858df7fd7eeb79dd1d559c4dd4b2851f7d0e0d98
Closes-Bug: #1386901
Create example generator

This code adds a feature to the tests where all of the example
snippets are generated and then validated. Tests fail if the new
examples don't match the old ones, meaning a dev changing the API
must update the snippets, triggering a conversation about the changes
during the pull request.

Implements: blueprint example-snippet-generator
Change-Id: I5f1bfd47558a646a56e519614ae76a55759a4422
Updated from global requirements

Change-Id: I30b63fc22d4c97af3be4ce64f24d9418a38d26ab
Fix broken instance provisioning with disabled volume support

Reasons:
 - in certain deployments that has disabled volume support, different volume types
   (iSCSI instead of virtio) Trove doesn't inject trove-guestagent.conf, userdata,
   disables "config-drive"-based injection

Changes:
 - refactoring code to use one common function to prepare files and usedata
 - adding to Nova call:
   - config_drive parameter;
   - userdata

Change-Id: Icfa7d26a29c313e0d3f056dda389787ca3638506
Closes-Bug: #1394654
Ensure Replication Tests do not use a stale token

Fixed the replication tests to re-authenticate the common test dbaas
client in order to ensure that we do not use a stale auth_token when
running the replication tests.

Change-Id: I37a2a4b7dca056e84b48c66cbe3b8c8fb6a2f1db
Closes-bug: 1394831
Merge "Fix broken instance provisioning with disabled volume support"
Merge "Deleting failed replication backup can hide error"
Merge "Create example generator"
Add few audit log messages to guestagent module

Few APIs were still missing log messages before calling RPC layer while
few others had multiple debug messages which I've squashed into single
log message.

Partial-Bug: #1324206

Change-Id: Ic6df12eb25497bfb39ea1506e41a37ba632e713c
Merge "Ensure Replication Tests do not use a stale token"
Merge "Added regression test for config with long value"
Merge "Added Replication templates for Percona"
Merge "Eliminate use of sudo for two things that don't need it"
Merge "Validate backup size during restore"
Rename attrs_exist() to contains_allowed_attrs()

attrs_exist() checks the attributes in the given list against the
attributes in the expected_attrs list. The name expected_attrs is
misleading since based on the name one would expect the given list
to contain all the attributes in the expected list but thats not
what this function does. Based on this, the following changes were
made:

- renamed attr_exist() to contains_allowed_attrs() which checks
  whether all the attributes in the given list is present in the
  allowed_attrs list.

Change-Id: Ie169271e211aa93c1bd3f64a2723aa1cd03a56e9
Closes-Bug: #1285964
Implement API strategy for Cassandra clustering

Partially Implements: blueprint cassandra-cluster