Verify the disk file exists before running qemu-img on it.

Should resolve bug 955788, although it is a little hard to tell
because the bug is so old.

Change-Id: Ic0c47f4b6181f56a98cf58d4ebe2cc926d06d524
attach/detach_volume() take instance as a parameter

Previously the methods take instance['name'] as a parameter.
With this change, ComputeDriver can lookup informations about
the instance from hypervisor (in bare-metal driver, it is a local DB)
by any other attributes of the instance.

blueprint general-bare-metal-provisioning-framework

Change-Id: Ibd0567f34ed5053909ce1a408f9cbf87516ba597
Move global glance opts into nova.image.glance

Move the glance_host, glance_port and glance_protocol options into the
nova.image.glance module.

Also move the generate_glance_url() and generate_image_url() utility
methods there since they're the only uses of the options outside of the
module.

blueprint: scope-config-opts
Change-Id: I3beca1a65cdd902a94ddc1c512d79a4de635ef38
Move global s3 opts into nova.image.s3

s3_host and s3_port are only used in nova.image.s3.

blueprint: scope-config-opts
Change-Id: Ia841406ebe7c03b2a58392e2453118e2646ad7ce
Move cert_topic into nova.cert.rpcapi

The cert_topic opt is only used in nova.cert.rpcapi and it makes sense
for the RPC module to "own" the topic option.

blueprint: scope-config-opts
Change-Id: If3584b8e1984e0425d9f33133f9d291739b04d49
Move network_topic into nova.network.rpcapi

The network_topic opt is only used in nova.network.rpcapi and it makes
sense for the RPC module to "own" the topic option.

blueprint: scope-config-opts
Change-Id: Icd779f34df47ac6dd048b3e41995e872d8859872
Move console_topic into nova.console.rpcapi

Even though the console_topic opt is used outside nova.console.rpcapi,
it makes sense for the RPC module to "own" the topic option.

blueprint: scope-config-opts
Change-Id: I0f00927ca1c0bba7b21315240165e83e7075ebb7
Move scheduler_topic into nova.scheduler.rpcapi

The scheduler_topic opt is only used in nova.scheduler.rpcapi and it
makes sense for the RPC module to "own" the topic option.

blueprint: scope-config-opts
Change-Id: Iafb8705eb716b650b63e060fe1dd36666bcee812
Adds a new tenant-centric network extension

Implements: blueprint tenant-networks

Adds a new API extension that supports a more tenant-centric model for
interacting with isolated networks. Additionally, the patch renames the
existing networks extension as os-admin-networks to more fully fit the
self-described implementation. Two new novaclient extensions and a
novaclient change accompany this patch.

DocImpact

Change-Id: Ib90a65c0a92445f86e930fab88ab4495aefff7c7
Added sample tests to FlavorRxtx API.

Partially implements blueprint nova-api-samples
Fixes bug 1091743

Change-Id: I400e627cfc499b3e7bb1c88d6ce7d24b4d222b84
Fix serialization in impl_zmq.

Sync rpc from oslo-incubator to include some fixes to impl_zmq:

    https://review.openstack.org/#/c/18913/

Change-Id: I5f5c157e81026c108df04bd385776a9985d4a497
add to driver option to keep disks when instance destroyed

Adding delete_disks flag to destroy instance method.
In case it's false the driver keeps disks.
*required for blueprint rebuild-for-ha

DocImpact

Change-Id: I38c7833114d8414dff831c9cc0c04c4610dbd33a
Co-authored-by: Oshrit Feder <oshritf@il.ibm.com>
Add to libvirt driver instance_on_disk method

Added method to driver layer to validate that instance directory
accessible from the host.

part of libvirt driver support for blueprint rebuild-for-ha

DocImpact

Change-Id: I9c6a3aec99f61bd4fb6bc4b4264771e077aae96a
Co-authored-by: Oshrit Feder <oshritf@il.ibm.com>
Adds to manager init_host validation for instances location

While the compute was down the instances running on it could be
evacuated to another host. The method checks that instance host
identical to current host. Otherwise destroying it.

part of blueprint rebuild-for-ha

DocImpact

Change-Id: Ic90df2b2887ee203e6d8261084e3f97773c5d81c
Co-authored-by: Oshrit Feder <oshritf@il.ibm.com>
Clarify the DBApi object in cells fakes

Adds a docstring and makes instance_get_by_uuid() raise by default.
It's only used as a stubbing point, but returning 'None' is not really
valid and having it raise might save someone some confusion in the
future.

Change-Id: Ie3fa333288f9c0263ead69c2d307101b8583dea7
Sync log from oslo-incubator

Change-Id: I292789214d74d00c33d5111625b452bb1b339c4f
Enable Aggregate based availability zones

Instead of implementing availability zones in the service table,
availability zones are implemented using general aggregate metadata.

This patch does not remove availability zones from the service table, a
latter patch will do that.

* In theory supports a single compute node in multiple availability zones
* Drop availability_zone column from Aggregate table (is now a property)
* map aggregate metadata 'availability_zone' so API does not change

Implements blueprint aggregate-based-availability-zones

Change-Id: I2a2ac5bfaa526d639dff5efa392c051347dbd9bb
Remove availability_zones from service table

This is the final step in enabling availability_zones using aggregate
metadata. Previously all services had an availability_zone, but the
availability_zone is only used for nova-compute.  Services such as
nova-scheduler, nova-network, nova-conductor have always spanned all
availability_zones.

After this change only compute nodes (nova-compute), will have an
availability_zone. In order to preserve current APIs, when running:
* nova host-list (os-hosts)
* euca-describe-availability-zones verbose
* nova-manage service list
Internal services will appear in there own internal availability_zone
(CONF.internal_service_availability_zone)
Internal zone is hidden in euca-describe-availability_zones
(non-verbose)

CONF.node_availability_zone has been renamed to
CONF.default_availability_zone and is only used by the nova-api and
nova-scheduler. CONF.node_availability_zone still works but is
deprecated

DocImpact

Completes blueprint aggregate-based-availability-zones

Change-Id: Ib772df5f9ac2865f20df479f8ddce575a9ce3aff
Import latest timeutils from oslo-incubator

Fixes bug #1097464

Changes synced are:

 a08daf1 Use basestring instead of str for type check.
 615d769 Account for tasks duration in LoopingCall delay
 ce80aac Convenience wrapper for datetime.timedelta.total_seconds()

Change-Id: If4ab7ccd2f4e815e01c41f25fdd541ffcd7693d5
Cope better with out of sync bm data.

The baremetal hypervisor tracks references to instances which are
deleted asynchronously from the commit to the nova bm. As such, its a
normal but rare condition for a bare metal node to refer to a deleted
(and even garbage collected) nova instance. We should treat such
instances are deleted rather than erroring on any call through
list_instances(), permitting starting new instances and listing
instances to work - fixing bug: 1096722.

Pathologically, the database may suffer permanent skew, which means we
need a way to fix it (and thats tracked as a separate bug).

Change-Id: Ic21ff66b1fc0ad64bb5feff26291873b96d20e4e