Specify DB URL on command-line for schema_diff.py

The exising schema_diff code had the DB URL format hard-coded which made it
difficult to work with since different environments with have different
user/password configurations.

A more flexible way to handle this, is to have the DB URL specified directly
on the command-line.

Change-Id: I313bb616e439072e007c886a7f131efc6a61f6df
Make hypervisor_version an int in fakeVirt driver

This is a follow up to 9e770e62135fe9c2c8ac0121a5a79245b25a7847, which
missed the change in a duplicate copy of host_status.

Add regression test to test_virt_drivers.

This requires changes to the API samples, because they were wrong. virt
drivers use convert_version_to_int which converts a version string to a
4 digit number ("1.0" becomes to 1000)

Change-Id: I28ce23509e3c9feae183a49a8fc5bf3c7c601295
Closes-Bug: #1285035
Accurate exception info in api layer for aggregate

Adjust log information for exceptions in api layer for aggregate
according to
https://wiki.openstack.org/wiki/LoggingStandards#INFO_log_level_is_for_Operators
the LOG.info was removed because nova api already reported error to operator

Change-Id: I89394407495cf2d346e1f532ada236a4364aab24
Fix security group race condition while creating rule

Previously, it was possible for someone to create a security group rule
where the rule references another security group. To do this nova would
first create the security group rule and then look up the referenced group
(group_id's) name in order to return that via the api. During this time
it's possible for someone to delete this security group rule and the
referenced group before the call returned resulting in a 404 error being
raised. This patch addresses this issue by looking up the group name
first and then creating the security group rule in order to avoid this
from occuring.

Note: this patch also adds a test to cover the case where an invalid group
id was passed though this does not really add any real additional coverage
to the change largely because the code is currently using global stubs. That
said, the previous coverage should hopefully be sufficient

Change-Id: If58ffa5629ba5166f260379ac47922974de31be0
Related-bug: 1262566
VM in rescue state must have a restricted set of actions

Right now it is possible to pause, suspend and stop a VM in state RESCUED,
so after the state is changed, it's not possible to trigger unrescue anymore
since the original state is lost.

This patch remove vm_states.RESCUED as valid state from stop,
pause and suspend actions.

The vm_states devref is also updated to reflect this change including the
current reboot flow.( vm_states.RESCUED cannot be rebooted as per
today code)

DocImpact
Closes-Bug: #1319182
Co-Authored-By: Cyril Roelandt <cyril.roelandt@enovance.com>
Change-Id: I531dea5a5499bf93c24bea37850d562134dee281
Run instance root device determination fix.

Legacy bdm in incoming parameters contains a number of devices
specified by their names (e.g. "vdb" or "/dev/vdc").
Current code considers "vda" as root device and doesn't work on
"/dev/vda", for example.
This fix extracts the last significant character (digits
are skipped in "..sda1")  from the name like "a", "b", "c" and
selects the root device by checking for "a".

Change-Id: Iebaa117bb747d30ac9ceabd8805740dec9d1355c
Closes-Bug: #1322180
Add API schema for v2.1/v3 migrate_server API

By defining the API schema, it is possible to separate the validation
code from the API method. The API method can be more simple.
In addition, a response of API validation error can be consistent for
the whole Nova API.

Partially implements blueprint v3-api-schema

Change-Id: I9f1eea8471af0f86dcf472ed8a4fdb634dfdb260
Move oslotest to test only requirements

oslotest is only used for unit testing, so
it shouldn't be in requirements.txt

Change-Id: I5073fbd93712072cec8598663590e35fc2edd08d
xenapi: virt rescue method now supports objects

Commit a37a96fd13b933123e80ad24e37fc37d73c16059 ensured
that the compute API and manager are now getting objects
for the rescue method.

This patch adds support to the virt driver code.

Change-Id: I06e5032526f791dfc0c523f2302d2edff5023f78
libvirt: virt rescue method now supports objects

Commit a37a96fd13b933123e80ad24e37fc37d73c16059 ensured
that the compute API and manager are now getting objects
for the rescue method.

This patch adds support to the virt driver code.

Change-Id: I2ae89f937b1983a2b0599e2eded343aa8358dbba
libvirt: virt unrescue method now supports objects

Commit 65ad230af5ece020822fa963dd30fd641a54ae91 ensured
that the compute API and manager are now getting objects
for the unrescue method.

This patch adds support to the virt driver code.

Change-Id: I5cca3fa997042b164c21fe2a13c2311f4b18ec06
xenapi: virt unrescue method now supports objects

Commit 65ad230af5ece020822fa963dd30fd641a54ae91 ensured
that the compute API and manager are now getting objects
for the unrescue method.

This patch adds support to the virt driver code.

Change-Id: Ie6b587d3f89202a6987291bfaea88290241651f2
V3 Pause: treat case when driver does not implement the operation

Some virt drivers may not support this operation.

Change-Id: I21a3fbb6e41e4a32810fd8c76f0fabb7aeff9244
novncproxy: Setup log when start nova-novncproxy

Because log system not setup, so log_dir, log_file config item not work.

Change-Id: Iabe7a4ca41dc0de8c752f013f6afeed5fd80b4ea
Closes-Bug: #1291949
Add subnet routes to network_info when Neutron is used

This change adds subnet routes to the network_info.

Extensions and future code will now have access to subnet routes.

Change-Id: I0827494dd5c95eb596e526204a2d94fcda2bb0dc
Closes-bug: #1315207
Use VIF details dictionary to get physical_network

Modify mlnx_direct plug and unplug to retrieve physical_network
from VIF details dictionary if network meta dictionary does not contain
physical_network. This will serve ML2 case following the guidelines to
populate vif_details dictionary with attributes required for port plugging.

Change-Id: I0d97bc875be2fff18087c78accef3ec81c059c4b
Closes-Bug: 1304872
Fix cold-migrate missing retry info after scheduling

If the resize failed, nova-compute will try to rescheduling this resize
task. But the retry info is missed at resize compute task. This patch
add the retry info back.

Change-Id: I1b60704955e2fb218d047394dd20afe7f971c03d
Change listen address on libvirt live-migration

Previously, in order for libvirt live migration to work,
the graphics listen addresses (VNC and/or Spice) had to be
set on both machines to be 0.0.0.0 or ::.  This was because libvirt
would try to rebind to the source address on the destination
machine, but would fail due to the source machine already having
that address (this would not happen for 0.0.0.0 or ::, however).

Now, a modified copy of the instance's XML is passed to libvirt's
migrate function, such that the listen addresses are that of the
destination machine.  The addresses are stashed in the pre-migration
data by the destination pre-migration method.

Note that this functionality will only work on versions of libvirt
with the VIR_DOMAIN_XML_MIGRATABLE flag.  If the flag is not detected
(anything vanilla libvirt less than 1.0.0), the live migration code
will fall back to the old method.

Fixes: bug #1279563

Change-Id: I6c9500283027193179c11d18ad4242e165a9ad6e
Fixes hyper-v volume attach when host is AD member

The domain name gets added to the initiator name used by the host
if it's an Active Directory member.

Currently the method which gets the initiator name does not take
this into account when retrieving the default initiator name.

Trying to use a wrong initiator name will lead to an exception when
trying to log in to the according iSCSI target.

This patch simply appends the domain name (when the host is an AD
member) to the initiator name used to log in to iSCSI targets.

Closes-Bug: #1328870

Change-Id: Ifbe762c685e46081059a01043431b2c4ac5473fc
Virt: remove unnecesary return code

The methods attach_volume, detach_volume and swap_volume should
not return anything.

The purpose of the patch set is to have a consistent behaviour across
drivers for the aforementioned methods.

Change-Id: I381ede44d71cd5f6ce98804853e4e8f587b46c99