Loosen import_exceptions to cover all of gettextutils

Now that we are starting to move over to multiple log domains we want to
import multiple items on the same line for gettextutils.

Change-Id: Icd88774a0f1087270234a6849bf96a93c0927534
(cherry picked from commit 2d75fafb88f7e871ae63304f88eb34e48edac2e1)
shelve doesn't work on nova-cells environment

The compute_api shelve/unshelve methods expect an Instance object,
but cell is still passing the sqlalchemy form.
So adding shelve/unshelve to the list of methods that will receive an
Instance object when using nova-cell.

When shelving instance with nova-cell environment,
instance object needs to contain 'metadata' and 'info_cache'.
So fetching the same from databse and adding it to
instance object before calling shelve/unshelve methods.

Conflicts:
    nova/cells/messaging.py

Closes-Bug: #1338451
Change-Id: Ia31b33c9a1d347f15d3e0a67fa31ef6b25a7407a
(cherry picked from commit 9d4b49c542e2076c8a572d1e8c6d50e255efe087)
Delete image when backup operation failed on snapshot step

when we snapshot an instance, we will use @delete_image_on_error to
delete any failed snapshot, however, the image will not be removed
by backup code flow, it will be an issue if too many backup failed
at last ,all useful image will be removed and we have only 'error'
image left in host

Change-Id: Ib527ade86aef52a8445b57fa03fed434578c4204
Closes-Bug: #1288574
(cherry picked from commit 3824051b1e5618388a17c88867a3037397bc96b7)
libvirt: convert cpu features attribute from list to a set

Currently, the cpu features list which is being sent to libvirt,
when creating a domain or calling compareCPU, must contain only
unique entries. Multiple issues arise when we are updating the
features attribute in LibvirtConfigCPU class (for example during
migration).

This change will change the features attribute from being a list
to a set. This make the LibvirtConfigCPU class keep only unique
features.
Adjusting the LibvirtConfigCPUFeature class to support set
operations by overriding the __eq__, __ne__ and __hash__
methods.

Closes-Bug: #1303536
Change-Id: I6350fe0e827c860aea77cc4fe56f18f5c1483580
Cherry-pick-x: 60c899b9da8d64b4a5979b69c43c77ed9d5bf248
replace NovaException with VirtualInterfaceCreate when neutron fails

Currently NovaException is being raised by the _neutron_failed_callback()
and being treated in a try..except block that wraps the _crate_domain method.
The exception is too generic and will catch any exceptions, which are
subclasses of NovaException (for example: ObjectActionError),
making the domain variable not be defined and will mask the original exception.

Suggesting to raise and catch the VirtualInterfaceCreateException and
treat the domain destroy and cleanup with save_and_reraise_exception
in the except block.

Conflicts:
        nova/virt/libvirt/driver.py

Related-Bug: #1337860

Change-Id: Ic972e286ded4e8b9d79ce1b0aa514bb4623d5f0b
(cherry picked from commit f0388d6fec0c4830c730af1adb3d02027eb2cd1d)
VMware: do not cache image when root_gb is 0

Save space on datastore when the instance size has root_gb of
0. There is no need to cache the disk as it already exists on
the datastore.

TrivialFix

Closes-bug: #1304593
(cherry picked from commit 9b14ae62a6396a2599c8a2ada1a50e3f69a2eddc)

Conflicts:
	nova/tests/virt/vmwareapi/test_driver_api.py
	nova/virt/vmwareapi/vmops.py

Change-Id: Iac75d97f40a1a91b8fa2df7fb4318fc2965fd93a
Fixes Hyper-V SCSI slot selection

Currently, when attaching volumes, the Hyper-V driver selects the
slot on the SCSI controller by using the number of drives
attached to that controller.

This leads to exceptions when detaching volumes having lower
numbered slots and then attaching a new volume, as Hyper-V will
then try to use an occupied slot.

This patch fixes the issue by simply getting a list of used slots
and getting a slot that it's not among those. It also checks
for the slot number to be smaller than the maximum number of slots
per SCSI controller.

Fixes bug: #1329764

(cherry-picked from commit a73e31022c9fef532cc2d66462d13f4ab2358565)

Change-Id: Id0c09c4debc848004a78971670cc3caef2f77ce3
Add expire reservations in backport position.

Change-Id: If0e58da50ebe9b50b414737a9bd81d93752506e2
Related-bug: #1348720
(cherry picked from commit f4454f4c6962dd2c57c08dc7fecfcdebe7924e3b)
Add a retry_on_deadlock to reservations_expire

Now that we have an index for the reservations_expire query, we
have uncovered a race with quota usage updates due to the foreign
key on the table, so just retry if there is a deadlock. This is
a fix to unblock the gate while we try to remove the deadlocks
completely.

Change-Id: I1993c3bd1f81facf1d98a4e29f9e8df4858a7d66
Partial-bug: #1350466
(cherry picked from commit 3619c1914e9925e18c062bc11bc3e708137f8322)
Read deleted instances during lifecycle events

This prevents us from failing to find the associated instance if
the lifecycle event happens after the instance has been deleted,
as in the case of a ... delete.

Change-Id: I819ddf8ff68edc407d7932bf43771c440f514f26
Closes-bug: #1304968
(cherry picked from commit 53ad788af6ced83bd9d6e58a25196a325d60fc4e)
Fix FloatingIP.save() passing FixedIP object to sqlalchemy

This prevents the FloatingIP.save() method from passing the
calculated FixedIP object to the sqlalchemy floating_ip_update()
function, which would expect it to be an SA object. It also
aborts any attempt to save the object with a modified fixed_ip_id
linkage, as associate/disassociate should be used for that.

This also fixes a bug where FloatingIP expects the result of
floating_ip_update() to be a FloatingIp SA object.

Added missing import to allow tests to work in stable/icehouse.

Change-Id: I065caedf4d81c8583a3b390934a1d403cf2e87bd
Closes-bug: #1334164
(cherry picked from commit 48de2895b9a550a0944b31212349275605a4061d)
Bump stable/icehouse next version to 2014.1.3

Bump stable/icehouse next version to 2014.1.3

Change-Id: If0b0267b047e9a9e1e67c49f62f2e11e9a9b18ea
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Merge "shelve doesn't work on nova-cells environment" into stable/icehouse
Merge "Fixes Hyper-V SCSI slot selection" into stable/icehouse
Merge "libvirt: convert cpu features attribute from list to a set" into stable/icehouse
Fix expected error details from jsonschema

The jsonschema 2.4.0 release slightly changed some of the error messages
that are provided when validation fails. This updates the unit tests to
expect the proper string and avoid failing as a result.

Change-Id: Ic8e32140e49e394659e7ebbecb28afb704b23b7c
Closes-bug: #1358881
Update block_device_info to contain swap and ephemeral disks

An ephemeral or swap disk is attached to an instance on boot
as follows: nova boot --flavor FLAVOR --image IMAGE_ID
--swap 512 --ephemeral size=2 INSTANCE.  When a hard reboot is
performed on the instance, nova fails to recreate the
appropriate libvirt XML definition, containing the ephemeral
disk.  This is because the correct block_device_info dict that
is passed to the compute manager's reboot_instance method does
not contain swap or ephemeral disk key values that are necessary
to recreate those disks.  In addition to nova boot, the correct
block_device_info dict is also needed by nova rebuild, reboot,
resize, and migrate to recreate those disks.  This patch updates
_get_instance_volume_block_device_info (renamed
_get_instance_block_device_info) to return the swap and ephemeral
disk key values, in addition to the block_device_mapping it
already returns today.

Change-Id: Iec329d1c12a48ea90ba9d57decd0996fde6544f0
Closes-Bug: #1305423
(cherry picked from commit f087a6f77ef1338bb8d10943d2a18712220c3c44)
Merge "replace NovaException with VirtualInterfaceCreate when neutron fails" into stable/icehouse
Merge "Bump stable/icehouse next version to 2014.1.3" into stable/icehouse
make lifecycle event logs more clear

Instead of logging integers in a cryptic way, log the human
readable strings for VM event state transitions. Also use the
existing instance_uuid port of the logger instead of putting that
separately into our log message.

Partial-Bug: #1357063

Change-Id: I96c39ad4494aa06a8dd5bd942c669a16836a8b9c
(cherry picked from commit 79c8bee9be7b6cf4e9fd3365a162f93a2b014bb5)