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
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
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
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
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
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
Fix setting backdoor port in service start

Previously if self.manager wasn't defined for a Service object but a
backdoor_port was specified then that particular service would not
start because it would try to set the backdoor port in an object that
didn't exist. This commit fixes setting the backdoor port only if
manager is defined when calling start().

Closes-Bug: #1243260

Change-Id: Ib0e709cfd0e299a3e010450b7eba6e92bc108e4e
Drop RPC securemessage.py and crypto module.

As of 579109cab946a54f86b04724f0b6cb71fb027c04 Nova should
have the openstack common crypto modules to support
rpc/securemessage.

The RPC securemessage stuff will eventually get integrated into
oslo.message. As is it is only partially complete in oslo-incubator
and it is getting synced into various projects (and breaking
some things).

This commit drops securemessage.py which was missing classes in
the crypto module anyway and would not have worked.

Closes-bug #1241634

Change-Id: I050d620a51042007aa4696fa439bd99c7597a9a4
Fix getting nwinfo for Instance obj

This fixes the get_nw_info_for_instance() method in nova/compute/utils.

If an instance object has no 'info_cache' (means we lack an entry in the
instance_info_caches table for the instance), don't try to access the
'network_info' attribute.  Just return a network model with empty
networking information like the dict version of an instance would do.

Change-Id: Ib1f49f10cefeefc55a87fea69b6fbc772c978dca
Closes-bug: 1243291
Reply with a meaningful exception, when libvirt connection is broken.

Libvirt driver will respond with a meaningful error on any
command, when the connection to the libvirt service is broken.

Closes-bug: #1240344
Change-Id: I823fefaffcf969ecf9eb853ac99dc18cef92d137
Add byte unit constants

A lots of numeric expressions are needed to caculate byte number
across Nova project, such as 1024*1024 , 1024**3 etc. This patch
add constants and will replace these numeric expressions in
following patches. That makes code more readable.Use these constants
like: root_disk_gb = 5 * unit.Gi

blueprint byte-unit-clean

Change-Id: Ic9aad949733d375aaa695d4292ff1b171d1def78
Apply six for metaclass

__metaclass__ cannot be used in python3.
six be used in general for python 3 compatibility.

Change-Id: I6d344b738cea7b9cda07cdc0e7e13fa73afa93b1
Closes-Bug: #1236648
Replace basestring by six for python3 compatability

The builtin basestring abstract type was removed in python3,
use str instead, we need to using six.string_types to replace
the basestring for python3 compatibility.

Partial Implements bp basestring-py3-compatible

Change-Id: I719e104ae46ebb6e986c53a019b93e3a45e6d0fd
Merge "Apply six for metaclass"
Merge "Add byte unit constants"