Sync db.models.Instance* with migrations.

This patch syncs models with migrations for:
    - InstanceIdMapping
    - InstanceMetadata
    - InstanceSystemMetadata
    - InstanceTypeExtraSpecs
    - InstanceTypeProjects
    - InstanceTypes
    - InstanceGroupMember
    - InstanceGroupPolicy
    - InstanceGroupMetadata

Blueprint: db-sync-models-with-migrations

Change-Id: Ice28b9d545f60f7df381e3fcf2c86a2b8e7350d3
Moved tests for server._action_rebuild

Move tests to separate class as a preparation for code
deduplication.

This work continues in https://review.openstack.org/34556

bp nova-tests-code-duplication

Change-Id: I985232fa0a9b2d5b73034047b06138a8a3d7e390
Code dedup in tests for server._action_rebuild

Externed common parts to setUp():
- request body
- request object
- test image UUID
- test image URL
These parts were equal in the most part of the methods.

bp nova-tests-code-duplication

Change-Id: Ie29dd090075915a4065ee395b4e50fc178f72f3b
Add expected_errors for extension deferred_delete v3

Partially implements bp v3-api-extension-versioning

Change-Id: Ia63f6cd947c20a05e84385f2401d6b869ebeb456
ec2-api: Disable describing of instances using deleted tags as filter.

Previously, one could describe instances using a deleted tag filter
that was once associated to the instance. The current change disables
describing instances via a deleted tag. Also,minor refactor in the
same function.

fixes bug #1197242

Change-Id: Iac6aa85b69d5a6dc563c00f3497cdab08e178ec1
Add ability to factor in per-instance overheads

Currently free memory calculations in the compute layer use a single
value to account for all memory overhead needed by a host.  This value
is: CONF.reserved_host_memory_mb

This patch adds the ability to factor in per-instance virtualization
overheads into usage calculations.  Virtualization overhead may differ
based on the flavor or other factors such as number of vcpus on a host.
This feature's goal is to provide the ability to do more accurate
computations of a host's overhead without having to pre-configure a
best guess in advance.

The actual calculation of overhead is left up to each virt driver to
implement.  This patch defaults to zero overhead for compatibility.

Change-Id: I4febfa2c837e0f80cee85ca74553829c960a3efc
Use timeutils.utcnow() throughout the code

timeutils.utcnow() should be used instead of direct calls to
datetime.datetime.utcnow() to make it easy to override its return
value in tests.

Add a hacking rule to prevent regressions.

Fixes bug 1200141.

Change-Id: I170dbd7c9093bd627e2a0d5984b7ad1bf105c8d5
Correct the action name for admin_actions API v3

Partially implements bp v3-api-extension-versioning

DocImpact

Change-Id: Idf92a043e8451626a62a651aa532c9ba1e614057
Move _validate_int_value controller func to utils

This patch moves the _validate_int_value private method of the servers API
controller (intorduced in change
I18ac285d5b3c8200d7706c7d577809b15d6ab9e8) to utils, in order to make it
usable by code outside of the controller class. This method is very
general - it checks weather an input is a valid integer.

It also changes what exceptions it raises from HTTPBadRequest to
InvalidInput - all in the spirit of being more reusable.

Finally, it adds tests and fixes a small string formatting bug that was
uncovered by adding them.

Change-Id: I65f2b6474d572ed601d20dca9dda9936d306a219
blueprint: improve-block-device-handling
Merge "Add ability to factor in per-instance overheads"
Merge "ec2-api: Disable describing of instances using deleted tags as filter."
Merge "Correct the action name for admin_actions API v3"
Merge "Add expected_errors for extension deferred_delete v3"
Make admin API state resets use Instance.save()

This removes the 'update_state' compute API method in favor of having
the admin API use the Instance object's save() method.

This also removes the non-unity cells test for resetting state.  Cells
behavior is tested via tests on Instance.save().

Related to blueprint compute-api-objects

Change-Id: I28d1ca9d711679cc55375774e879870f457a5b0b
Make shelve pass old-world instance object to conductor

The conductor interface for notify_usage_exists() doesn't yet
work with a new-world object, so convert it with the compatibility
function before passing it from shelve().

Related to blueprint unified-object-model

Change-Id: I6c2c2dc6dedf521ed7b0c566411d6f0035038b7c
Make InfoCache.network_info be the network model

Instead of storing the DB version of network_info (which is a JSON
version of network.model.NetworkInfo) on the object, go ahead and turn
it into its native object as well.  This means that all uses of the
object don't need to worry about hydrating network_info themselves.

This adjusts all uses in the code understand the old and new ways of
life.

There's also a small issue with the get_by_instance_uuid() method that
would cause a traceback when no entry was found.  This method is not
being used yet anywhere, but this is fixed to raise a NotFound.

Related to blueprint unified-object-model

Change-Id: I882311c8a9f9df927c5650946e6398eeb33e74d0
Convert network API to use InfoCache object

This converts the db.info_cache_update() call in network/api to use
objects.  The save() method has been extended to support what we need
for cells.

Converting to the object allows us to ditch the conductor_api kwarg on
some methods.

Related to blueprint unified-object-model

Change-Id: I1722c03d20511d67acc0a8947de1d4273dc78597
Unit-ify compute_api delete tests

This makes the delete and soft_delete tests unit-like in nature,
and moves them to test_compute_api, as has been done recently
for others that we're moving to objects.

Related to blueprint compute-api-objects

Change-Id: I5e024871e5159f08cbba05fa261a9a2d08e4b8e5
Merge "Sync db.models.Instance* with migrations."
Merge "Make admin API state resets use Instance.save()"