nova-manage: remove redundant 'dest' args

Includes a hack to calculate 'dest' from the argument name. This hack is
removed in a later commit.

Change-Id: I60567ff232ab7699f3234b3bfc1618a17a648976
Update to Quantum Client 2.2.0

This patch updates tools/pip-requires to use the python-quantumclient 2.2
It also limits the version to <3.0.0 to prevent breaking something accidently
when 3.0.0 is released.

Fixes bug 1152695

Change-Id: Ic47deccac1df5a1b6b5171f1f7d80b250b57ebc9
Fix OS-DCF:diskconfig XML handling

Removes string to bool conversion for the OS-DCF:diskconfig
attribute during XML deserialising as the diskconfig extension
expects a string (MANUAL or AUTO) not a bool.

Fixes bug 1152439

Change-Id: Id9a5c2559a2891c2a21c437c9a5a534b9885c9bf
Prepare services index method for use with cells

Move the api.openstack.compute.contrib.services' index method's logic
out of the openstack api layer and into the compute api layer.

The addition of the availability_zone information is already done by the
host api. For this reason it was removed from the openstack api layer.
The behaviour of the call remains the same, only the functionality has
been moved.

This patch makes the functionality automatically work in cells.

Work towards: bug #1150499

Change-Id: Ia9489f11608167aed5168ccb3b670f395f7de5f7
Fixes instance task_state being left as migrating

In a cross-hypervisor environment, such as KVM + Hyper-v. After negative test
which live migrate a KVM instance to Hyper-v host, there will be an exception
InvalidHypervisorType. As a result, the instance task_state is being
left as migrating. That leaves the instance in a broken state and most of the
requests on the instance will fail.

Actually, there are some other exceptions will cause this issue as well, such
as UnableToMigrateToSelf, DestinationHypervisorTooOld. All of them are thrown
from the driver of scheduler during live migration. But obviously, if the live
migration fails at the schedule stage, the task_state of the target instance
should be updated to None.

Fixes Bug: 1153283

Change-Id: Ide4b48653268c8dbe31de6964814830d2e82a5ba
Fix behaviour of split_cell_and_item

If you try to split a cell and item, with no path!to!cell@ in it, it'll
now return None for the cell, instead causing a ValueError when trying
to split the result.

Change-Id: I228b9f3b0f63f8c7a6004b3206f5312ed2a878bc
Fixes: bug #1153841
Remove the usage of instance['extra_specs'].

Instance type extra specs is remove from instance dict, so use inst_type['extra_specs']
instead of instance['extra_specs'].

fix bug #1146253

Change-Id: I1d3542e5142f490269607b779daa507f9d7b36e4
Fix more OS-DCF:diskConfig XML handling

Add handling in the deserialisation code to handle the
OS-DCF:diskConfig attribute in the rebuild and resize actions so
the diskConfig extension can handle it properly. Formerly only
the older auto_disk_config attribute was managed (and incorrectly so).

Fixes bug 1153133

Change-Id: I68479d258cf23083274dd21b1f9eabab2feeb093
Add missing tests for db.block_device_mapping_* methods

There was no tests in test_db_api for block_device_mapping_* methods.
Add tests to ensure that all works. Also these tests allow us to refactor
work with session in these methods.

Fix bug in is_ephemeral we should return True or False not instance of
_sre.SRE_Match or None.

blueprint db-api-tests

Change-Id: I3cac17e7d2c8d0b2608fb9a78ea29210f025222b
Refactor work with session in db.block_device_mapping_* methods

Remove explicit use of session where it is not required.
Also this is small performance optimization, because if we put
session parameter to Models.save() method will create subtransaction.

blueprint db-session-cleanup

Change-Id: I6064f3df2daf0178009c4cf40da293f71ca6972a
Virtual Power Driver list running vms quoting error

This patch corrects a issue with VPD when configured for virsh the
list running vms function attempts to execute $2 instead of the actual
command.

Fixes Bug 1154280

Change-Id: I6d06cc58fb0f2935c4341761908b914106bda916
Authored-by: Chris Krelle <nobodycam@gmail.com>
Make run_instance() bail quietly if instance has been deleted

Right now, we make a big mess in the logs if someone deletes an
instance before we get a chance to run it. This cleans that up
to a single warning message.

Fixes bug 1154292

Change-Id: I2de0c2993d6a16d9482878eee4eef10bfd78c3e6
List ConsoleTypeInvalid as a client exception.

get_vnc_console() and get_spice_console() in nova.compute.manager should
list ConsoleTypeInvalid as a client exception for rpc. This prevents the
rpc layer from logging a traceback for this exception when raised. It is
an expected type of exception that the client should be left to handle
how it would like.

Fix bug 1154301.

Change-Id: I3a359cbb4edbfabea1775e927b6f9947db26a284
Don't load system_metadata when it isn't joined.

If we always load system_metadata, it will throw a sqlalchemy
error if it isn't joined in the column. Rather than putting it
in extra keys we need to explicitly join it if it is missing.

Adds a test to make sure that system_metadata is returned
properly from the migration call even though the extra keys
parameter was removed.

Fixes bug 1146000

Change-Id: I05365906ed528a06fe5704449dab72c857fefa65
Fix cells instance deletion

Instance delete and soft_delete are broken with cells when the API
doesn't know the cell of an instance.  A traceback occurs in all child
cells.  Also: soft_delete results in a 'hard' type being sent to
child cells vs 'soft'.

Fixes bug 1154333

Change-Id: I13ac839fa13a66caa100a3459bcc8e1183821ff1
Return error details to users in "dns-create-private-domain"

Fixes bug 1135539
When SysLogHandler is configured in UDP socket mode, the user
who doesn't have the admin privilege got the unexpecting internal
server error(HTTP 500) in "nova dns-create-private-domain" command.
This bug occurs as the call graph drew below:

|--ProxyCallback._process_data():amqp.py
                          |--LOG.exception()
                          |    :
                          |    |--BaseHub.switch():hub.py
                          |                 |-- clear_sys_exc_info()
                          |
                          |--ctxt.reply(None, sys.exc_info(),..)
                                       |
                                       :
                                       |
                         |--serialize_remote_exception():common.py
                                       |--failure_info#(None,None,None)

The sys.exc_info() is cleared by the clear_sys_exc_info(), but it is
called again by the ctxt.reply().
This patch prevents the internal error and returns the details of
the forbidden error(HTTP 403) which is expected.

Change-Id: I76d4a938e66bfaf44423f7586e00db2caf9f5dde
LibvirtGenericVIFDriver update for stp

Fixes bug 1129055

The patch will set the stp status as 'off' and the bridge
forwarding delay to 0.

Change-Id: Ie9c96caa797de623ef0b357c61f1b7233a7d869e
Read instance resource quota info from "quota" namespace.

Scope all instance resource quota params such as CPU(cpu_shares,cpu_quota,
cpu_period), disk IO(disk_read_bytes_sec,disk_write_bytes_sec etc.),
network bandwidth(vif_inbound_average, vif_outbouand_average) to "quota"
scope in extra_specs, so that it doesn't conflict with compute_capabilities_filter.
after this patch, user should use:

nova flavor-key m1.tiny set quota:cpu_shares=1000 to set parameters.

Fix bug #1146322

DocImpact

Change-Id: I30e550d21f00eb949ee2f3f8fb4d952c10bf8000
nova-manage: remove unused import

Unused since commit 9ff3121b

Change-Id: I76bb49669d1cdfc3bf5b1c20087b4bd77420cd91
Do cleaning up resource before rescheduling.

Fix bug: #1153964

If some exception raised when spawn instance, the instance will be
rescheduled to other host. But just deallocate network before
rescheduling is not enough, like security group filters and volumes
will stay on old host.

So shutdown instance and clean up volumes instead of just deallocate
network before rescheduling.

Change-Id: Ieb6220ae66f0b97a92c50f6998f456968b516fcb