Fix incorrect root partition size and compatible volume name

When using rbd backend, it needs to resize volume size if size presents. Else
we will get wrong image size.

Rbd volume always uses uuid as the main pattern of volume name, now change to
it is necessary.

Fix bug 1219658

Change-Id: I3dc8d639b066eac35d190b8d4687c41c9f4d5824
Remove compute_api_class config option

This option was deprecated in Havana and can now be removed.  Its only
use was for changing out the API class if cells was in use.
Technically, it used to be possible to configure an arbitrary compute
API class.  However, that would have been an unsupported setup, and has
been completely broken since 9f902c7e17249cf5af1504f31d80c0247a02fe20
anyway.

As a part of this change, the cell_type configuration option needed a
default value.  I set it to 'compute'.  My reasoning was that you would
have more compute cells than API cells, so might as well set it to the
more common case.

Change-Id: I5ec44f84267a700da16b350e686eee886e0d1183
fix missing host when unshelving

An instance has the hostname of the host on which it is running.
The hostname is deleted when shelving. However, the hostname is not
recreated when unshelving.

This patch sets the hostname when unshelving.

Change-Id: I2e431718198321c46b9335e6fb7ab7be3943fab6
Closes-Bug: #1237868
Check for None when cleaning PCI dev usage

The PCI manager needs to check for instance UUIDs mapped to
None when cleaning up it's internal claims/allocations maps.

Also adds a check so the claims dict doesn't map to None in
the first place.  There was already a check like this when
setting a value in the allocations dict.

Closes-Bug: #1238374

Change-Id: I7ac010f7d50ad85c145e536cfd48e07c8f4602d3
xenapi: stop agent errors stopping build

We should still report agent errors, but they should not stop a server
from building, because that server still may be ready to use.

Once this change is in place, we can look to selectively add back in
certain errors that fail the build, as we decide what makes sense on a
case by case basis.

Fixes bug 1233548
Change-Id: I32b9e8dbc6e28a045ac8ef159afe1cf74b7ac6fb
Use `versionutils.is_compatible` for Dom0 plugin

Related-Oslo-Commit: d7d74a752e34d5249fa47c8e8252da491d46012a
Change-Id: Iffb19f186fe2b239361fc342de0042acfa5e098d
Fixes Hyper-V snapshot spawning issue

In Hyper-V, snapshoting an instance and then spawning a new
one using the resulted snapshot image with the same flavor,
will result an Hyper-V Exception.

Hyper-V will get the request to resize the base image to it's
actual size, leading to an error.

The reason is that the logic of the resize_vhd method has been
changed, as it is meant to resize images to the flavor size minus
the image metadata size, thus it's maximum internal size. For this
reason, the way to decide whether the root image should be resized
or not must also be changed.

So, instead of comparing the root image and base image sizes,
we should compare their maximum internal sizes.

Closes-Bug: #1234759

Change-Id: I83d2df76b726d705cedc52a8309a2be7037d6a79
xenapi: speedup test_wait_for_instance_to_start

Speed up the above test by mocking out greenthread.sleep

Change-Id: Ie5637842bade28d7ed01cbfe39ed2a46edc6e919
xenapi: Speedup vm_util and vmops tests

* Uses NODBTestCase in more places

* Also, adds VMUtilsTestBase so that all new test cases in test_vm_utils will,
by default, not use the database.

Speed up observed from running:

nosetests nova/tests/virt/xenapi/test_vm_utils.py
          nova/tests/virt/xenapi/test_vmops.py

BEFORE: Ran 113 tests in 7.674s
AFTER: Ran 113 tests in 1.873s

Change-Id: Id05ecac90201fba27cbae7480d3119cacd92ec24
xenapi: test_driver should use NoDBTestCase

Change-Id: If75d924accb50dca3cc393c32ddcb9128604fa88
Cells: Fix instance deletes

A regression was introduced with object conversion that caused all
instances to be locally deleted in the API cell when cells is enabled.
This would happen before the child cell was told to delete the instance.

Additionally, if an instance record was created in a child cell but
failed to schedule to a host in such a way that the API cell has
no knowledge of the 'host', the instance would be deleted in the API
cell only.

Also, it appears that we would cast deletes to child cells twice due to
logic duplicated in cells_api.py that exists in api.py.

Closes-Bug: #1240247

Change-Id: I94cfddd9cef2d63b2cb31c0f2dae8e211a4418d9
Remove duplicated test cases

The class ServersControllerCreateTest has the following duplicated
test cases since I091f14a9753059d759ba2f7b05ff33f5abea0f00 :

 * test_create_instance_with_config_drive_disabled
 * test_create_instance_local_href
 * test_create_instance_admin_pass_empty
 * test_create_instance_invalid_personality
 * test_create_location

This patch removes the duplicated test cases.
In addition, this removes the bookhref of test_create_location() also,
because it is not used.

Change-Id: I218d5ff443d4dbcec7520eab0b42e77fbd30eba8
powervm tests: replace assertEquals with assertEqual

In Python 2.6, both assertEqual and assertEquals are
convenience aliases to failUnlessEqual.

In Python 3, failUnlessEqual is explicitly deprecated.

This is part of blueprint assertequal

Change-Id: I978f61e5340ea554ec81118d8d282d10e28fe00d
Update timeutils.py from oslo

This fix is related to oslo-incubator commits:
3bc6f79d794aee9d51abc0be10e846b971fae847
af76064855c5bb888e1a0d2800d1f49470e19091
df3f2bafbe76d78d017d40e7dc08909fee7dbe34

Change-Id: I1194df94d85d3dde29e81003c0c3db735c66b35f
Adding Read-Only volume attaching support to Nova

Supporting attach a volume with Read-Only mode in libvirt driver.

Implements bp: read-only-volumes

Related-Id: I4c84614d6541d5f7c358abadb957da7b8c3d9c48
Change-Id: Id5ef7b25350cb1bde9d30fbfa98fb7a80081827f
Signed-off-by: Zhi Yan Liu <lzy.dev@gmail.com>
Add CIDR field type

This field type provides a strong verification that a value
assigned to a CIDR field is valid. This will be used for
the SecurityGroupRuleObject to follow.

Related to blueprint compute-api-objects

Change-Id: Ib62a515eea563da3107a3aed516a51d0ff55ba35
Updated from global requirements

Change-Id: Ica7315effe308bd739e90f885849fac27a3c542b
Updates OpenStack Style Commandments link

The current link in the HACKING file is broken. This references the
correct location for contributors to view.

Change-Id: I3cd4841035400d09a3e3e3369bb3a2a8c4bdee30
A nicer calling convention for object instantiation

This patch makes the base object constructor take some arguments
to streamline the process of creating a new object. By taking
a context and an optional set of keyword args, we can reduce
the lines of code required to create an object from many to, often,
one.

Change-Id: Id85c70d04af500ece48e9c93ee55a8e3d579299d
Merge "xenapi: speedup test_wait_for_instance_to_start"