Fix quota issue where usages can drop to negative value

This is caused by an exception occuring in the model when creating
and instance. When this happens, the quota rolls back but the DB
record, created for that instance, does not. This issue is NOT fixed
in this patch but depends on
BP https://blueprints.launchpad.net/trove/+spec/security-groups-workflow-update

What this fix does is adds a check that prevents quota usages drop below 0.

Also it fixes a bug where the reserve quota was being set and not added.
This causes problem when multiple requests are sent at the same time
and causes race condition issues.

Fixes bug 1178333

Change-Id: I1c64941815b91e58d79b17d7a6e69c15c1daaf36
Modifying tests to use the compat client

Modifies tests so they use the old style client code.
This is still exercising the actual v1.* code, it is
just accessing it via the compat module.

partially implements blueprint cli-compliance-upgrade

Change-Id: I5578525325416a28d7ab772ad0817f49ff6c6611
Add GA related parameters to trove-taskmanager.conf.sample

Adds placeholders for 'guest_config' and 'cloudinit_location'
to trove-taskmanager.conf.sample

Fixes bug: 1237395

Change-Id: I5214f5fcc785d94b5b2b60dead316768980d7909
Update trove-guestagent.conf.sample

Add missing 'service_registry_ext' parameter
Remove obsolete 'guestagent_manager' parameter

Fixes bug: 1237910

Change-Id: I66606672bd5bdad21c00ce2ad8d7a8eb62cff8cc
Fixing restart tests

* Remove rax specific tests
* Fix delete test grouping
* Fix the mess up mysql logic
* Fix ovz command if CONF.use_local_ovz
* Fix logic in Checker that was masking errors in tests

Fixes: Bug #1204233

Change-Id: I6ac8abb47d4cff0ae20432f059686e4f1dd55a7e
Update statuses on GA timeout

Updates instance status if GA stacks at BUILD status
after poll_until
Change-Id: I581f67d1be9f8e9b2080daa86d51d89326840c5c
Implements: blueprint update-instance-task-status-if-instance-stucks-at-build-status-to-error
Quote and escape pagination markers

urlparse.parse_qsl urldecodes fields in URLs, but
the next URL and the next marker are then out of sync.
This change reverses that behavior, and also makes sure
that dots in markers are also escaped as %2e as they should be.

fixes bug #1188352

Change-Id: Idfb7b4cbd3c14bb0d34c506d7d3d5d3683735e7d
Merge "Update trove-guestagent.conf.sample"
Merge "Fix quota issue where usages can drop to negative value"
Merge "Quote and escape pagination markers"
Replace deprecated method aliases in tests

Some of the TestCase methods have been deprecated since python 2.7.
We need use correct names.

http://docs.python.org/2/library/unittest.html#deprecated-aliases

* replace 'assertEquals' with 'assertEqual'
* replace 'failUnlessAlmostEqual' with 'assertAlmostEqual'

Change-Id: I90da87723e3e36767946d276301b75af801b952d
Merge "Fixing restart tests"
Fixes pagination with non-string markers types.

This allows the pagination code to work even if the next marker is
not a string but a different type such as a date time.

Fixes bug 1240275

Change-Id: Iee7223a8b6907254b9ab345c592bff208885a36e
Merge "Add GA related parameters to trove-taskmanager.conf.sample"
Merge "Replace deprecated method aliases in tests"
Provide service type management code structure

Reasons for refactoring:
- current code structure is orientied on mysql management implementation;
- there is no chanse to make new service types management
code fittable in current package/module structure;
- backuping process implementation is mysql/percona-orientied,
it should be renamed and should be configurable due to service type;
- "query" is abstract word for querying into database,
current query.py implementation is SQL orientied - it should be renamed;

Updates:
1.Providing new package hierarchy:
   guestagent/manager/service_type/service.py
   guestagent/manager/service_type/manager.py
   guestagent/manager/service_type/system.py
2.Renaming strategy implementations per each service_type
   guestagent/strategies/backup/mysql_impl.py
3.Externalizing operating system definer form system.py
 which used in pkg.py
4.Renaming query to sql_query.

Implement: blueprint refactor-ga-for-other-engines-support
Change-Id: I5fa5f037056bedf5464e99720cbe03b877c27fba
Moved create_instance DNS attempt to post-prepare

Moved the actual attempt to add DNS to after the prepare call because of
two issues 1) instances that have failures on DNS end up in a condition
in which the container is unusable - there is no support to send a
prepare call otherwise and 2) DNS isn't required for any operations
after it's addition thus making it a gating operation for prepare makes
no sense because if there is a failed DNS request, retrying that
operation is much less complex than re-issuing a prepare call and
support teams can handle this by hand.

blueprint trove-taskmanager-send-prepare-before-dns

Change-Id: I51fa2115e3d52a85aa87970903922f25bae3bf9f
Simulates events so run_tests.py executes 10x faster

This restores some functionality that had been removed earlier to use
a class from Oslo. It turns out making it work with the new Oslo RPC
manager code wasn't too hard, plus the new version is hopefully easier
to follow.

Change-Id: I18e4d06359f28605cd764a10ace791997f534ed7
Implements: blueprint bring-back-event-simulator
Merge "Fixes pagination with non-string markers types."
Fix User ID in Context and Notifications

    Notifications should contain the User ID not the User Name
    This change replaces the deprecated X-User header with
    X-User-Id.  In most cases, the User ID is preferred over the
    name.

Fixes: Bug 1235145
Change-Id: I3cce6b35fc40f4ff4cc45b04714067956fb1864c