Fix divergence in attach_interfaces extensions

I pointed out in revision 7 of Ibe4cbd025700aa0d73a6d4d19fbf8f0005509428
that it we shouldn't use a different variable name in the identical code
shared between the v3 and v2 extensions, but that was never fixed before
merging.

Change-Id: I7c2853db2cbad30a37efd98947ebe687b37bfbe8
baremetal: Add missing method to volume driver

Added get_hypervisor_version(), which is called by underlying
LibvirtVolumeDrivers. Also added tests roughly checking if the
underlying drivers can be loaded and be called without error.

Partial-Bug: #1208707
Change-Id: Ida6b6800d1ef518c6e76d6b2ab4ac2f795a744ca
Fix error message of os-cells sync_instances api

Because parameters of this api are 'updated_since' , 'project_id'
and 'deleted',add 'deleted' to the message "Only 'updated_since'
and 'project_id' are understood."

Change-Id: Ic2b2314861030b029be5df490e123d8976711193
Closes-Bug: #1237836
Port server actions unittests to V3 API Part 2

Ports the server actions unittests to test the V3 API.
This mostly involved CamelCase to camel_case changes
and adpating the URLs to point to the V3 API instead of
the V2 API.

It also includes
- Fixing a bug in the admin_password extension picked up by
  the tests where bad request data is not always handled properly
- Generate image ref urls that point to glance api rather than
  the nova api. This fits in with the decision to not port the images
  extension to the V3 API which is implemented here:
  https://review.openstack.org/#/c/40565/
- Moves admin password related tests to the admin password unittests
  test file as this functionality has been moved out from core.

Partially implements blueprint v3-api-unittests

Change-Id: I58b4c0103c824898183fca890c74c3c1cbe19633
Remove xenapi rpm building code

Nova shouldn't be building any types of packages. And if we are we should
be testing this code in gate somewhere.

Change-Id: I70d82a6173b5eda183d4e49d330ae97dd14f9078
Add testr concurrency option for run_tests.sh

By exposing this testr concurrency option, run_tests.sh can now specify
how many processes to run the tests. If not specified, default 0 utilize
maximum CPUs available.

Change-Id: I1a518ae67db32d9838e4a3584cfc3af14212be3c
Ensure migration 209 works with NULL fkey values

Modify the sub-query on migration 209's backup to not select NULL
items which cause the NOT IN to always be false and consequently
the backup not to run resulting in a violation of the foreign keys.

To test, add an instance with NULL uuid to check the backups still
work correctly and avoid violating the foreign key constraint.
If there are NULL values in a NOT IN () set the result is always
false. Therefore having this instance inserted causes migration 209
to fail unless the IN set sub-query is modified appropriately.

Change-Id: Id0f8c8cb082df8861e85f925b979ddd934a95bfc
Closes-Bug: 1240325
Add V3 API sample for admin-password

Adds api sample tests and api samples for admin-password

Partially implements blueprint v3-api-unittests

Change-Id: Iade39ff931471d1d68e358ac5d35a1921e85df66
Adding support for multiple hypervisor versions

This is to prevent instances with newer tools from being provisioned
on older hypervisors.
Added comparison of hypervisor version from the compute-node and image
metadata in the image properties filter.
In host scheduler image_prop_filter, the 'hypervisor_version_requires'
image properties, if available, is compared to the host_state's
hypervisor_version, if available.
hypervisor_version_requires should be added on the image as metadata and
should have a operator and version value.
Examples : ">=6.0", ">6.0, <6.2", ""!=6.1"

Partially Implements blueprint xen-support-for-hypervisor-versions
Cell scheduler changes coming up in another commit.
DocImpact

Change-Id: I6fbf232adf9ac78ebb8ac2985739f163f4517d14
Fix tests for migration 227 to check sqlite

The _check_227 test skips for sqlite despite modifying that dialect.
It also has a redundant check for an existing row that doesn't work
when snake-walking the migration tests.

Change-Id: I58d9a539868d50e345a6dfa78918e04a4a699a68
Closes-Bug: 1240751
Add missing ' to extra_specs debug message

Change-Id: Ia4c54111c0221adadd5a9e049a1f048e46cbc608
Fixes unicode issue in the Hyper-V driver

The XML string returned by the WMI API calls requires unicode
conversion before further processing, e.g. with ElementTree.

This affects the vhdutilsv2._get_vhd_info_xml method due to
the textual description. The issue came to light using the
host with Chinese locale, while not present on a en_US host.

Fixes bug: #1229671

Change-Id: I09435a205abfc8ae9470c53c5446cbb28dee0115
Add obj_make_compatible()

This adds a method to NovaObject that allows it to convert itself to
and older version, within a compatibility window. So, if an object
had a revision that added or changed the formatting of an attribute,
the obj_make_compatible() method can fix up a primitive representation
before it is sent to a client expecting the older version.

This is primarily intended to be done by conductor when object(s)
are returned from classmethods by potentially-older compute nodes
with older object representations.

Related to blueprint icehouse-objects

Change-Id: I95772e8d3290443c43e57955384ea4fc20b9dcce
xenapi: Speeding up more tests by switching to NoDB

nosetests nova/tests/compute/test_compute_xen.py
          nova/tests/virt/xenapi/image/test_bittorrent.py
          nova/tests/virt/xenapi/image/test_glance.py

BEFORE: Ran 13 tests in 3.435s
AFTER: Ran 13 tests in 0.374s

Change-Id: I00cc990dab3f9af2c19aa57b84817fafc1cb01e9
xenapi: Speeding up the easy cases of test_xenapi

These were the tests that only required changing the base class. The remaining
tests in test_xenapi will need to have their stubs modified to not hit the DB.

nosetests nova/tests/virt/xenapi/test_xenapi.py

BEFORE: Ran 201 tests in 25.957s
AFTER: Ran 201 tests in 24.573s

Change-Id: Ia0478ac81f1b2b316a22b15e3171250d3b839073
Fixing ephemeral disk creation.

The patch addresses 2 scenarios, which occur when
CONF.default_ephemeral_format was provided:

1. Creation of ephemeral block devices would fail,
   due to permission issues, during an attempt to format it without sudo,
   in _create_local.
2. The device/image would be formatted twice, while the final
   filesystem will differ from the one provided in
   CONF.default_ephemeral_format.

This patch will format only once, relying on the changed
disk.mkfs command, that takes CONF.default_ephemeral_format
into consideration.
It will also run the command as root only for block devices,
according to the disk_image is_block_dev property.

Closes-Bug: #1204424
Change-Id: I2bf7abc982e20eaaf7bca7cd798b4134b76d10a8
Fix all scripts to honor the enabled_ssl_apis flag

Add logic to allow configuration of SSL for all the cmd scripts
that start a WSGIService

Change-Id: I921013d113081a91a3fe9bb574bae5cd7bb06bcc
Closes-Bug: 1237126
Hyper-v: Change the hyper-v error log for debug when resize failed

The error message is not sufficient enough for debug of hyper-v
when resize error occured, this patch adding the necessary info
in error log.

Change-Id: Ic8ecb8f08139face2c7bdca258de5e719d81833c
Closes-bug: #1238430
Make security_group_get() more flexible about joins

This makes security_group_get() more flexible about the column
names it takes as join targets. This will let us pre-load things
on the instances that get fetched out.

Related to blueprint compute-manager-objects

Change-Id: Iadbcb7d469eb55add5ada33580c896c7186c98f0
migrate server doesn't raise correct exception

Currently a BadRequest is raised for the migrate and live-migrate API
operations when the given instance isn't found. This patch changes the
APIs to raise a InstanceNotFound instead to be consistent with the other
admin action APIs which hit the same type of error.

Closes-Bug: #1239038

Change-Id: I28cd367c5885481ea19ace43855b2518a2afd955