Don't need to init testr in run_tests.sh

In run_tests.sh, function init_testr will initialize testr if the
directory .testrepository is not existed. Actually, testr will do
the check before run the test:

In Python package testrepository, setuptools_command.py:Testr.run

68 def run(self):
69     """Set up testr repo, then run testr"""
70     if not os.path.isdir(".testrepository"):
71         self._run_testr("init")

So, init_testr can be removed safely.

Fixes Bug #1211098

Change-Id: I4bd2ef3dc107281892732efced268eb3b7c90cbb
Raises masked AssertionError in _test_network_api

The _test_network_api method was catching an AssertionError to do some
more checking but failed to raise the original error if the checking
didn't hit any matches. This patch fixes the test to raise the original
assertion error.

Closes-Bug: #1212017

Change-Id: I33147d18e33cd4babfc3f5cb572007bc7e4c07e6
Implement front end rate-limiting for Cinder volume

Cinder adds Quality-of-Service control interface to allow admin to
specify QoS parameters as well as the place where these parameters
should be consumed (Front-end: Nova Compute, Back-end: Cinder
Volume, or Both) for volume types.  KVM and other hypervisor is
known to be able to do disk rate-limit control (one form of QoS)
for virtual disks, this patch enables Nova Compute to extract
rate-limit parameters for volumes while attaching, currently
libvirt only.

implement bp volume-rate-limiting

Change-Id: Ibcc8f15ab744600e6f814b46935f8022d78074fc
Fix untranslated log messages in libvirt driver

Fixes bug 1213040

Change-Id: Ib3b7a46c312b88778cc6e872a2c19061a5774125
fix volume swap exception cases

Currently when the target instance id doesn't match with the instance_id of the
volume to be replaced VolumeUnattached is raised, and InvalidVolume would be a
fittest response.
In the other hand, currently, when the volme to be replaced is not attached at
all InvalidVolume is raised, and VolumeUnnatached would be a fittest response.

Change-Id: I661b97762af70765ab8111313d24cf1a175f7e6c
Added test case in test_migrations for migration 208

This patch is to add test case in test_migrations.py for migration 208.
Migration 208 was brought by commit 74b024f75403c168b5c69ee67a16d1053965e5db
(Change-Id: I72371260159c9fdffcdb57209095fc103b6dd79e)

Change-Id: I153abf260716c8af61d7ccf554d91ba80f559e60
Signed-off-by: Shane Wang <shane.wang@intel.com>
Make xenapi capabilities['enabled'] use service enabled

filters.compute_filter is enabled by default along with libvirt, but the
capabilities['enabled'] section of it is only supported by XenAPI.
This used to work by adding a parameter to capabilities, but since
the capabilities RPC is being removed, use conductor.service_update to tell
the scheduler which host is disabled.

service_update is already the way to tell the scheduler about other
disabled hosts, so to keep backwards compatibility keep host_enabled but
use service_update underneath.

Part of bp no-compute-fanout-to-scheduler

Change-Id: Ica1919cfe9a2402b2107c557c10d47e01a6c430b
Correct the status code to 201 for create v3

Partially implements bp nova-v3-api

DocImpact

Change-Id: Ie7413f0f6473ad12b84f84688c7c8c377ebf39e1
Object support for instance groups

The patch set adds object support to the instance groups.
This is required for: https://review.openstack.org/#/c/30028/

This is part of the blueprint instance-group-api-extension.

Change-Id: I599016b7a15d6045ae5129352eacc60a37ac7106
Fix aggregate creation/update with null or too long name

Fixes aggregate creation so an attempt to create an aggregate with
a null name results in a 400 Bad Request rather than 409 Conflict.
This was fixed for the V2 api in 43f9028f84ffec9b465bec10025ba75266c1bc22
and is fixed in this changeset for the V3 api

For both the V2 and V3 APIs adds a check to ensure that the aggregate
name is not longer than 255 characters.

Also fixes null or too long names when updating an aggregate

Fixes bug 1212240

Change-Id: I644a8a46f0b75e3717ecafec1889ce6316ca18c6
Link Service.compute_node with ComputeNode object

This is the third in a three-step dance to implement a Service
object, a ComputeNode object, and finish the relationship with
the circular reference from Service to ComputeNode. It adds
Service.compute_node, a nested object relationship that is either
lazy-loaded on access, or pre-loaded if a database query
includes it. This should exactly match the behavior of the
SQLAlchemy objects that we have now.

Note that this requires a new DB API method to look up a
ComputeNode object from its service_id. This was previously
provided by the SQLAlchemy relationship between the two objects.

Related to blueprint compute-api-objects

Change-Id: If62d443e34a3c8ce9bc83008fc69821494686bc7
Fix typo in baremetal docs

instanse_type_extra_specs=>instance_type_extra_specs

Change-Id: I8075d1e535e74616d7f1c05ba69f1c9f4c9d4293
Update availability_zone on time if it was changed

The problem is that when the availability_zones for one host
aggregation was updated, the VM attribute of availability_zones
which belong to the host in the availability_zones was
not updated on time.

If updated values include availability_zones, then the cache
which stored availability_zones and host need to be reset.

Fix bug 1203250

Change-Id: Ib3f08fbe3c74d5aa101da78faed43b0bc03cb988
Add DocStrings for function allocate_for_instance

Add DocStrings about params for function
API::allocate_for_instance.

Change-Id: I1dd1625ed6ebd1dfee6dc71f7227302f3e0ece9f
Imported Translations from Transifex

Change-Id: Ie00b44f5712ed1af796f6b13471162956bcf314e
Adds Flavor ID validations

* Flavor ID should not contain special symbols.
* Flavor ID should be in range 1-255 characters.
* Flavor ID should not have leading/trailing whitespaces.

Fixes LP Bug 1202136
DOCIMPACT

Change-Id: I63c36811a57982e826f22f827f86d40ff6a6210e
Remove unused nova.common module

It seems like the common is unused. I an wondering what jenkins will say.

Change-Id: I55366dc30e46b09d19124dbe821a115999bf7395
Add env to make_subprocess

Due to a previous commit, a client of make_subprocess is making a call
with an env parameter. As make_subprocess does not have such a
parameter, image upload fails. This patch adds the env keyword argument
to make_subprocess, and use that in the Popen call.

Fixes bug 1216267

Change-Id: I8098b484067b54c15fe95f2bf84c5890db7ebcb3
use 'exc_info=True' instead of import traceback

We need store traceback message in log sometime. Python logging module
already provide a argument to do that. For example, we could:

logger.error('msg', exc_info=True) # log current exc_info
logger.debug(e, exc_info=(type_,value_,tb)) # log exc_info passed in arg
logger.exception('msg') # exception add exc_info automaticly

There're many places using traceback, but only two places are using
traceback for loging exc_info. (some use to store into variable, some in
openstack/common leave this to oslo)

Change-Id: I96eff1e7a0437c358753e636a8a6ac860074cb25
Fix error messages in v3 aggregate API

Since moving error messages to HTTP responses from LOG.info()s,
the error messages has been unexpected formats like:
  "Cannot delete aggregate: %s <id>"
This patch fixes them.

Partially implements blueprint nova-v3-api

Change-Id: Iadc41ab254c1f17efdb08f23449a0bd7a94a8f6c