Handle compute node not available for live migration

This patch handles exception.ComputeServiceUnavailable by restoring
instance's vm_state and instance's task_state after live migration
failure caused by unavailable source/dest compute node.

Raises detailed HTTPBadRequest explanation for this exception.

Fixes bug 973393 and bug 1051881

Change-Id: If825b61fad9c4e3030f2e6c5002907255eaf3661
Fix update quota with invalid value

If update quota with a value which is not integer, it will response
with http status code 500. Catch the exception and continue for
updating other quotas.

Fix LP# 1111327

Change-Id: I0ab3b10ff106a2e6c7677d1acdb55c2f35c492db
Properly write non-raw LVM images on creation

Fixes bug 1075333

When force_raw_images=False and libvirt_images_type=lvm were set
together, selecting anything other than a RAW image would result in
an unbootable instance. This is because the downloaded image was
being directly dd'd onto the new LVM root, which will obviously not
work for any format other than RAW.

Simple change to use qemu-img to read from the image (letting it
decide the format) and write to the LVM root as raw.

Change-Id: I36494e6d0671c07f7511c10ef886c8cf84c18df7
Libvirt: Implement snapshots for LVM-backed roots

Uses the built-in LVM snapshotting mechanism to create a new
snapshot, use qemu-img to extract the full root into an image file,
then delete the snapshot volume. Although we typically zero deleted
LVM volumes manually, this is not necessary for snapshots, as LVM
handles it for us (per the documentation).

Change-Id: I82f21488671ffa3be3d0feba73ff631fa2a51ec0
Fixes: Bug 1120809
Flags: DocImpact
Refine PowerVM MAC address generation algorithm

Change MAC address generation algorithm on PowerVM to generate
an additional 4 bits of data and improve comments around it.

Change-Id: Icdfba54161bcb043c17127c26c57503af497d001
Remove locking declarator in ServiceGroup __new__()

The lock-based synchronization is not re-entrant, which
would introduce a deadlock with the new conductor patch.
Because race condition is not be possible in the
eventlet threading model with GIL, we simply remove the
synchronized declarator.

Change-Id: I03e52227385dafd2b2b66bca18cab8445c91f3be
Add an extension to show the type of an ip.

There is currently no way to differentiate a fixed ip from a floating
ip in the servers list. This extension adds the OS-EXT-IPS:type param
so that users can determine if it is a fixed address or a floating
address.

Fixes bug 1117784

DocImpact

Change-Id: I8709a4f2f6792faa3d8e0cdcd330d751ef6633ae
Simplify and optimize az server output extension.

Displaying two different az results to users is confusing, so just
return the az that the instance is actually in. Also, cache the
result from looking up the az by host for an hour to avoid making
lots of expensive db requests.

DocImpact

Change-Id: Ib39bf94c608874695aab00e61035e64f9594a985
Forces flavorRef to be string in servers resize api

flavorid column is a string in the database model and
MySQL silently accepts either integer or string as
data type. However PostgreSQL expects the right data
type. So we force it to be string as early as possible
in the api.

Fixes Bug 1123525

Change-Id: Id117868b3a2f840f5d7ab463f3b79b6631b3b514
Move allowvssprovider=false to vm-data field

Currently we're setting allowvssprovider=false in the other-config
field. However, this setting is not honored in the other-config field,
allowing vss-based snapshots to be created.

The allowvssprovider=false should be moved to the vm-data field in
xenstore as that field is used to decide whether vss snapshotting is allowed or not.

Amended to change: 'str(False)' to 'false'.

Relevant code:

https://github.com/openstack/nova/blob/master/nova/virt/xenapi/vm_utils.py#L233

Manually set allowvssprovider=false in the vm-data field:

xe vm-param-set uuid=<VM-UUID> xenstore-data:vm-data/allowvssprovider=false

References:

https://github.com/mcclurmc/xcp-storage-managers/blob/master/drivers/vss_control#L38
https://github.com/mcclurmc/xcp-storage-managers/blob/master/snapwatchd/snapwatchd#L298

Change-Id: I96efbc18cb7eb0ee2d0e6526b3c4f3502a68e1dd
Fixes: bug #1112673
Make compute manager use conductor for stopping instances

During _sync_power_states, the manager will call to compute_api to
stop instances as necessary. This takes a database hit, which isn't
allowed. This directs that call through conductor, following the
pattern of late.

Fixes bug 1123219

Change-Id: I5d789dd73390cb1c41a245f6594b1c3aecf7efde
Imported Translations from Transifex

Change-Id: I7c601a4dafaa6672d1e9caf4bc9fbdda535ff0ea
Merge "Add an extension to show the type of an ip."
Merge "Simplify and optimize az server output extension."
VMWare driver to use current nova.network.model

* Updated tests to use classes from nova.network.model instead of legacy
  "network,mapping" tuple.
* Modified vmwareapi/{driver,vif,vmops}.py to use classes from
  nova.network.model instead of legacy "network,mapping" tuple.

Fixes: bug 1112655
Change-Id: I7f4b39cd5add7d3cf7dcf485eb9855d0354f332c
Merge "Refine PowerVM MAC address generation algorithm"
Merge "Remove locking declarator in ServiceGroup __new__()"
Merge "Properly write non-raw LVM images on creation"
Merge "Libvirt: Implement snapshots for LVM-backed roots"
Merge "Move allowvssprovider=false to vm-data field"