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
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
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
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
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
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
Make resize raise exception when no valid host found

When resize operation starts, it will ask conductor to find a
valid host and try to resize to that host. When there is no valid
host can be found ,current code return directly without error
notification, which will make upper layer code (e.g novaclient)
thinks the execution is succesfully performed and report 'Finished'.
But actually it isn't due to no valid host was found.

Change-Id: I3d66dbfc0a7346762b920e802aa3be92c43d93b7
Closes-Bug: #1297052
Add API schema for v2.1/v3 create_backup 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: Ie8a1ce6d0d7b90fb73555981fa974e9029344d3b
Replace assertTrue(not *) with assertFalse(*)

Replacements were done in tests to have
clearer messages in case of failure

Change-Id: I7eedc62e0d570ee5818c4aa9b28ad8163c63b775
Add supported file system type check at virt layer

Currently nova doesn't check whether the file system type is supported
by virt layer(hypervisor) before use it. This patch adds current
support file system type definition then create a default check
function at virt layer. Following patches will do the real check
in different driver such as libvirt.

Change-Id: Ie4d876a48b36c1a53b171dd521bdeef868a31486
Partial-Bug: #1293880
Not count disabled compute node for statistics

No server will be scheduled to disabled compute service, thus we
should not count the corresponding compute node information.

It's arguable if we should count for 'down' service, since service
may be marked down because of communication error. If we do want to
exclude the down service, we need passing the information from caller
because the up/down state is not kepts in database, and it means compute
and cell api changes.

Closes-Bug: #1285259

Change-Id: I5e3e71ef30683c5eb5cc4462f58fa5f29d7c3f4b
Replace assertTrue/False with assertIn/NotIn

The following replacements were done in tests to have
clearer messages in case of failure:
- assertTrue(* in *) with assertIn
- assertTrue(* not in *) with assertNotIn
- assertFalse(* in *) with assertNotIn

assertTrue/False with custom error messages weren't
replaced because assertIn/NotIn doesn't have argument
'message' and we'll lose error messages if we replace it.

Also assertTrue/False with operator 'any' were
replaced with more simpler asserts assertIn/NotIn.

Change-Id: If5e78db21d5302259a4d69fd82c62baf39a5d8f8
libvirt: Support snapshot creation via libgfapi

Currently, the libvirt driver only handles volume snapshot
creation for file-backed volumes.

This changes allows volume snapshot creation for libgfapi-
attached volumes to work.  (A sufficiently new version of
libvirt is required.)

Implements: blueprint libvirt-volume-snap-network-disk
Closes-Bug: 1288976

Change-Id: Ic6dd861b40b692b25df67c9d5b63fd436c690fde