libvirt: Custom disk_bus setting is being lost on hard_reboot

Currently, a non-default disk_bus setting of and image will not be used,
when powering on an instance (or _hard_reboot).

hard_reboot() should use image_meta, if it exist, when constructing
the disk_info

Closes-Bug: #1255449

Change-Id: I477f69c47515ad22165421b4d23ac865c7869873
Rename instance_type to flavor in test_utils and nova.tests.utils

Renames occurrences of 'instance_type' to 'flavor' in
nova.tests.test_utils and nova.tests.utils along with any impacted tests
using the changed parts.

Part of blueprint flavor-instance-type-dedup

Change-Id: Ie816356c176c2be61b4a346a4d47d8f3461ae84a
Prevent spoofing instance_id from neutron to nova

Previously, one could update a port's device_id in neutron to be
that of another tenant's instance_id and then be able to retrieve
that instance's metadata. This patch prevents this from occurring by
checking that X-Tenant-ID received from the metadata request matches
the tenant_id in the nova database.

DocImpact - This patch is dependent on another patch in neutron
            which adds X-Tenant-ID to the request. Therefore to
            minimize downtime one should upgrade Neutron first (then
            restart neutron-metadata-agent) and lastly update nova.

Change-Id: I93bf662797c3986324ca2099b403833c2e990fb4
Closes-Bug: #1235450
Add IPAddress field type in object models

In object models, there are ipv4 address type and ipv6 address type.
However, for some fields in models.py, for instance, host_ip in compute node,
and a bunch of IPAddress variables in network, and address in other tables.

There is no field type corresponding to them, no matter whether it is v4 or
v6. So, add one more field type in object models to specify that type.

Change-Id: Ic53ed644f4bbc1e280b2f8cbb9b9c145c3d8a2e9
Update vnc virt driver api to take Instance object

Update the get_vnc_console() virt api method to take an Instance object
instead of a dict.  No real changes were needed in the drivers to make
this work.  While we're changing the API call, add the context, as well.

Change-Id: I2026ea725d61df4b88e7618f9fd4498c62843296
Pass Instance object to compute vnc rpc api

Pass a real Instance object to the get_vnc_console() method of the
compute rpc api.  The object_compat() decorator is used to provide
backwards compatibility with receiving data in the old format.

Change-Id: Ib615fd653e0ef6196241fde81f541b1e18eb3ced
Send Instance object to validate_console_port

Update the validate_console_port() method of the compute rpc api to take
in an Instance object instead of a dict.  The object_compat() decorator
is used to ensure the change is backwards compatible, and that the code
will still work if it receives an instance in dict format.

Change-Id: Ief8fabc8490315acb41bf85ad421683fea31daf9
Pass Instance object to console output virt driver api

Update the get_console_output() method of the virt driver API to be
defined to accept an Instance object.  While we're at it, pass the
context, as well.

Change-Id: If325a39f6314cff936e604fcc5816deefbb1199b
Make Instance object compatible with older compute nodes

This teaches the Instance object how to make itself compatibile with
older compute nodes running code from a few revisions ago.

Related to blueprint icehouse-objects

Change-Id: I3fe7d89751ad191c24cf6daa7e281eb480e83e1f
Require List objects to be able to backlevel their contents

Right now, a client declares its supported version of a given object
automatically in the remoted calls it makes to conductor. However,
in the case of things like InstanceList.get_by_foo(), they are
reporting the version of their InstanceList object, not their
Instance object. Conductor fills a version-matching InstanceList
object with brand new Instance objects, which the client, of course,
barfs on.

There may be a better way to handle this going forward, but for now,
stop the bleeding by requiring a version bump to the corresponding
List object whenever the object type it contains takes a version
bump. This adds a test to validate that all the objects registered
have a suitable mapping for the current version in the tree.

Since this actually caused a breakage in the Instance object
recently, this also bumps the InstanceList version so that
conductors running this commit (or later) will properly send
version 1.9 Instance objects to Havana clients and version 1.10+
to newer ones.

Change-Id: I2668dead4784fbd0411d1b6372a9a8006eeb2e84
Related-Bug: #1258256
Closes-Bug: #1254902
Merge "Update vnc virt driver api to take Instance object"
Merge "libvirt: Custom disk_bus setting is being lost on hard_reboot"
Merge "Make Instance object compatible with older compute nodes"
Merge "Require List objects to be able to backlevel their contents"
Merge "Prevent spoofing instance_id from neutron to nova"
Merge "Pass Instance object to compute vnc rpc api"
Merge "Rename instance_type to flavor in test_utils and nova.tests.utils"
Merge "Send Instance object to validate_console_port"
Merge "Pass Instance object to console output virt driver api"
Merge "Add IPAddress field type in object models"