libvirt: Get driver type from base image type.

If we are using the raw backend (no cow), we should set the driver
type based on the type of the source image instead of always
using raw.

Calls to to_xml were moved after _create_image so that the image
type could be determined when creating the xml for libvirt.

Fixes bug 1163009

Change-Id: Ic8d5f0ab83d868a42f834d39c0afb64818d7e027
baremetal: Integrate provisioning and non-provisioning interfaces

Originally, baremetal pxe/tilera driver managed two types of network
interfaces in two tables; provisioning interfaces in bm_nodes table
and non-provisioning (normal) interfaces in bm_interfaces table.
But, now actually both types are handled in the same way and there is
no difference between them except for which table they are in.

This patch moves the provisioning interfaces to bm_interfaces. However
it does not drop prov_mac_address in bm_nodes since VirtualPowerManager
still uses it to identify a target in a list of VMs returned by the
VM's host.

Change-Id: I5ce940e7127aa3b29ba7802612938dc5dbc3152f
Deprecate old vif drivers.

As per commit 4c0cecd3 (Change-Id I292c2fd7aa0c32b1c91d737152ed8e54ea2cf6ac)
Deprecate:
* LibvirtBridgeDriver
* LibvirtOpenVswitchDriver
* LibvirtHybridOVSBridgeDriver
* LibvirtOpenVswitchVirtualPortDriver
* QuantumLinuxBridgeVIFDriver

Change-Id: Iad854dfe91aaa18622f78aa92746d3ea2f986960
Define LOG globally in baremetal_deploy_helper

Since LOG = getLogger() has been moved from the global scope
to the function scope (main), the rest of the module could
not find LOG. This patch makes LOG global again.

Fixes bug 1165262

Change-Id: I2607802dcbed64135f75011a02ebce95519e4ea1
set timeout for paramiko ssh connection

set powervm connection timeout to 60 seconds
to eliminate crashing if ssh server is slow in
responding.

Change-Id: Ic7f4d092de73e73c6edb909713bf3a2347a50334
Fix error message in pre_live_migration.

We are using locals() to reference a variable which doesn't exist
in this error message. Also rename the instance variable while I
am here to be more consistent with other uses.

Resolves bug 1164072.

Change-Id: I96f5e2a81ac2e97181c3e87df83e19b381f4bcd2
Raise correct exception for duplicate networks

When using Quantum, if duplicate network ids are passed in on a
nova boot, nova-api raises a NetworkNotFound exception, which is
not correct.  This change causes it to raise a NetworkDuplicated
exception instead.

Fixes bug 1165088

Change-Id: I4f1f9aa5e1fa0e740b78e67760d924e2dd1d4d98
Import eventlet in __init__.py

All of this is because if dnspython is present in your environment then
eventlet monkeypatches socket.getaddrinfo() with an implementation
which doesn't work for IPv6. To turn this off you need to set an
environment variable before you do the import.

Resolves bug 1164822.

Change-Id: I2382db7b3ac4a2d940e0c45dfe3d48f499de2f16
Fix a bad tearDown method in test_quantumv2.py.

Cleanup code runs in LIFO order, so this was calling the mox methods
in the wrong order. Secondly the whole point of addCleanup is to
register code to run as soon as it is known that it should run, vs
tearDown which only runs if setUp succeeds, and doesn't know what
other code completed.

Change-Id: Iff3b91e9d43cc58b667b32cacc4b97b6e0e1f298
Evacuated instance disk not deleted

Adds disk cleanup in case instance is not on shared storage.
Added new methods to compute.rpc and virt.driver interface to validate
that instance files located on shared storage on remote compute node.

Fixes bug 1156269

Change-Id: Ia4cc601d0d824ba04f595df96461cfa85ad3b90c
Catch NoValidHost exception during live-migration

To avoid leaving the instance state as MIGRATING if scheduling of
a target host fails, add this exception to the list of exceptions
for which the instance task state is reset to None.

Resolves bug 1166771.

Change-Id: I23343091725051624c0eb0b82e9f03a7f9d5f4f4
Encode consoleauth token in utf-8 to make it a str

This is needed for memcached backend, because the key cannot be a
unicode object in any of the exposed functions.

Fixes bug 1164784

Co-authored-by: Stanislaw Pitucha <stanislaw.pitucha@hp.com>

Change-Id: Ieb1429116d96eefe97564fe92631063dc16117cb
Security groups may be unavailable

Currently all missing security group situations are reported as errors
and exceptions. This is not the case - any user requesting a wrong id
or name can cause it and it's not an issue in Nova. A busy system can
generate a large number of those messages causing unnecessarily high
error count.

This change stops reporting this situation as exception in the logs.

Change-Id: Ide856cbbde2db025b0e2def79652cc6c9b00566b
Merge "libvirt: Get driver type from base image type."
Merge "Security groups may be unavailable"
Merge "Fix a bad tearDown method in test_quantumv2.py."
Merge "Evacuated instance disk not deleted"
Merge "Import eventlet in __init__.py"
Merge "Catch NoValidHost exception during live-migration"
Add tenant/ user id to volume usage notifications

Volume usage notifications are generated to enable traffic based billing
on volumes. Include tenant id and user id to make these notifications
more useful to billing systems.

Fixes bug # 1158292

Change-Id: Ic71c10f0fc5d9e8c5a0e2f538de072e7ccca20ee