Handle invalid xml request to return BadRequest

Handled ExpatError,LookupError to return BadRequest
if the user inputs the invalid xml

fixes bug 1032092

Change-Id: I7374532d91e3d7675bc80730031a195f50bb2abc
Dis-associate an auto-assigned floating IP should return proper warning

Added new exception class CannotDissociateAutoAssignedFloatingIP and raised
exception instead of return.

Fixes bug 1061499

Change-Id: I348573a235c6b81653837267072b5c48fa15b8af
nova-manage doesn't validate key to update the quota

nova-manage doesn't validate the key value supplied to
update the quota, as a result unnecessary records will be
created in db and user will be under the impression that
quota value got updated.
This patch validates the input value given to the key.

fixes bug 1064359
Change-Id: I9928f30881aa2780a23005b5f69aa67a44f314c5
Add version to network rpc API.

This patch adds versioning support for the nova-network rpc API.  During
Folsom development I added versioning to all rpc APIs with the exception
of network and volume.  I was holding off on those to see what the fate
of that code in nova was going to be for sure.  Adding it to the volume
API in nova doesn't make much sense at this point (but doing it in
Cinder does).  Since nova-network is sticking around for a while, it
seems worthwhile to add a version number to the API for any future
changes while the code is still in the tree.

There are plenty of things in this rpc API that could be cleaned up or
improved, but I held off on doing any of those things.  I would
recommend the same for anyone else (unless it's a bug that needs to be
fixed).  I think any further improvements should be focused on Quantum
integration with Nova or Quantum itself.

Fixes bug 1060197.

Change-Id: I63ce57657388166544202af9c44c2298ae551aea
Add api samples to simple tenant usage extension

Change-Id: Ib6e00e5c049846146619f52732cd06fefac62494
Pass correct task_state on snapshot

This fixes an issue where we were not passing the correct task_state to
the compute manager thereby triggering an 'unexpected task-state error'
when the snapshot finished.

This error only manifested itself in multi-cell setups where the
compute-manager and compute-api are using separate DB's and therefore
must rely on the RPC-layer to enforce consistency.

Fixes bug 1065250

Change-Id: Ie07454f0d2075f5c3f2dd53b4e5ff9983ea3241f
Make sure sleep can be found

Some systems have only /usr/bin/sleep and no links. (like Arch)

Change-Id: I406dd72ba1a4669966ee58e110aee43ddf723b4a
read_deleted snapshot and volume id mappings.

Since the migration that creates the volume_id_mappings and
snapshot_id_mappings tables does not populate the 'deleted' column,
queries to this table should not limit results to 'deleted=0'.
Limiting to non-deleted rows results in duplicate mappings being
created for existing instance mappings after an upgrade, and
throws off volume and snapshot ID to UUID mapping.

This is a stop-gap measure to ensure avoid serious breakage during
an upgrade.  The NULL columns in this table are actually unused
currently and can be populated in later grizzly migrations, if they
end up being used.

Fixes bug 1065785.

Change-Id: I893c994362a203288b9984f0ede24cbb274bfcc5
Migrate DHCP host info during resize

Update instance host to migration_ref['dest_compute'] before
update_dhcp to make its DHCP host info will be written in dhcp-hostsfile.

Make similiar change in finish_revert_resize.

Fixes bug 1065440

Change-Id: I9d3e0ebf8512f98f2943999e7ad95bc58f2bf585
Used instance uuid rather than id in remove-fixed-ip

remove-fixed-ip called db method fixed_ip_get_by_instance. but
fixed_ip_get_by_instance use instance uuid not id, so change to
uuid in remove-fixed-ip.

Fixed bug: #1065899

Change-Id: Ic7526c7e91933424c04be9bb91d4a98cfedd9b01
Implement snapshots for raw backend

blueprint snapshots-for-everyone

Use simple qemu-img convert for raw snapshots.
Polymorphically select snapshot behavior for
raw and qcow2.
Allow images to be constructed from actual device/file path.

Change-Id: I6a57e43c6775c144c41a53382dcc7504ce6d4c43
Make run_tests.sh fail if no tests are actually run

Right now, run_tests seems to report test success if there is a
catastrophic failure early in the process. This can happen if you
have a python file that fails to parse, or if something else in
the test environment setup fails to initialize (such as creating
the empty database for the test run). Nosetests will report
success, but indicate that zero tests were run.

This patch snatches the output of nosetests and, if zero tests
ran, reports to the user that something is broken and offers a few
suggestions.

Change-Id: Ide6fd8b212f0650cb227f60b25d4b4e62ee150ac
Fix imports in openstack compute tests

This makes imports in a number of tests consistent. There were also
various places where files were being stubbed out that werent explicitly
imported. This patch fixes those as well. It also moves compute api
stubbing to stub the actual compute.api.API class instead of
compute.API. Includes a rewrite of test_createserverext to stub the
create method instead of doing a bunch of odd setup with a mock
compute api.

Change-Id: Id8ebb2f65228fafeac69c7ab635ff8909b79c449
Stops compute api import at import time

There is an automatic import of compute.api at import time
whenever anything under compute is imported. This leads to all
sorts of weird dependency problems such as the one here:
https://review.openstack.org/#/c/14170/

This modifies the import to happen when compute.API() is called,
which is how we handle it for network and volume. A few imports
were also modified to make it consistent with this new style.

Change-Id: Ic748376510aa4cc48dfefc6ec36621d0ae498bfc
Merge "read_deleted snapshot and volume id mappings."
Merge "Make run_tests.sh fail if no tests are actually run"
Merge "Migrate DHCP host info during resize"
Merge "Used instance uuid rather than id in remove-fixed-ip"
xenapi: Tag volumes in boot from volume case

Fixes bug 1064134

Since https://review.openstack.org/#/c/10574, we require that all
openstack volumes are tagged, so as to distinguish them from other
disks that could be deleted on instance termination.

Change-Id: I965f88bf41d39be88f2331ad081f5cec71a65a0f
Merge "Dis-associate an auto-assigned floating IP should return proper warning"