Janitorial:  Catch rpc up with a change in common

Common rpc now uses jsonutils instead of json; this
patch moves that change into nova.

Change-Id: Iba45e473ae875b0973dbe6f752602b58c7980578
Properly name openstack.common.exception.

Now it's 'nova.openstack.common.exception', thanks to a more modern
update.py in common.

Change-Id: I4b3caf9014f866da3a5bbf07ab194fc9910159b0
Propagate setup.py change from common.

This pulls in the following patch:

commit 8a967b16dc2ffd60bc19bee09f45e665ddcc9a81
Author: Monty Taylor <mordred@inaugust.com>
Date:   Mon Jul 2 17:19:06 2012 -0400

    Fix up openstack-common build.

    Ironically enough, even though the code to manage this is in
    openstack-common, openstack-common wasn't using it. This patch fixes doc
    generation, as well as setuptools-git integration and versioning.

Change-Id: Ibb2041b131c67aba963e2dd81dcdfd105e1f9b33
Fix snapshots tests failing
bug 1022670

When running snapshot test, FLAGS.instances_path is defined as '',
with snapshot_directory='/snapshots' which will fail to to permissions errors.

Modified class LibvirtConnTestCase to use libvirt_snapshots_directory=''

Change-Id: I930e4f30ddffcf66c58312e92f0ae368e770e438
Expose over-quota exceptions via native API.

Fixes bug LP 1021373.

Previously an over-quota condition would be exposed via the EC2 API,
but hidden in the corresponding call via the native API (in the sense
of the exception detail being replaced with a generic 500 Server Error
response).

We now report any NovaException declared to be safe. In this patch,
the set of safe exception types includes any subclass of QuotaError,
but in subsequent patches the net should be widened to include
exceptions that do not expose senstive information.

Change-Id: I3cc36337c7e67cf487ca49de646c437c217ae538
associate_floating_ip an ip already in use

Fixes bug 10014860 to be compliant w/ AWS EC2 spec
instead of return exception.FloatingIpAssociated,
disassociate from old fixed_ip and associate to
new fixed_ip.

Change-Id: I54ab3492092940dbb01f2787cc329a0162698568
only mount guest image once when injecting files

Previously we could incur the costly guest mount operation twice,
if injecting files with any of net, ssh keys, password, metadata.
Instead now inject files in the same operation.

Also cleanup the internal injection functions a little
by removing the unused 'execute' parameter.

Partly mitigates the impact of bug 1013689.
Change-Id: Ib66d327e745593cf1e5897470750d609b2a58980
Always attempt to delete entire floating IP range.

Fix bug 1021222.

This patch tweaks nova-manage to always attempt to delete all addresses
in the specified IP range, even if an error is encountered.  This is an
easy way to handle a case where a range was created, but then a subset
of that range was deleted.  Otherwise, deleting the rest of the range is
a pain.

An example of this would be:

  # nova-manage floating create --ip_range=1.1.1.0/24
  # nova-manage floating delete 1.1.1.1
  # nova-manage floating delete 1.1.1.0/24

Previously this would fail.  Now it works.

Change-Id: Ia01c04dee5383f597976c6a79d9a0d9e19985898
ensure libguestfs mounts are cleaned up

Make a few attempts to umount the libguestfs
mounts, in case other processes are accessing
the mounts (like udev etc.)

If we still can't umount after 5 attempts
(with average delay of about 1s between each),
then initiate a lazy umount so that the mounts
might be automatically cleaned up at some stage.
We wait a further 10s after initiating the lazy
umount, before raising an exception.

Addresses the original issue in bug 1013689

Change-Id: Ib5ede9f705c833825a19308c140f99c5bf3a776f
Remove deprecated auth from GlanceImageService

* Drop the code block specific to deprecated auth in image
  deletion code
* Remove reference to deprecated auth in the auth_strategy
  config option help text
* Related to bp remove-deprecated-auth

Change-Id: Id0f4f287d33d01d54642fbc544ada9b7ef1b83ec
When over quota for floating ips, return HTTPRequestEntityTooLarge.

Previously we were returning a generic Internal Server Error which seems dumb.

Fixes bug 1021721.

Change-Id: Ia30b8de22bcc00d159bb4894ab4dc5f4870c346b
overriden VlanManager.create_networks must return a result

Fix bug #1022469

Change-Id: Iaaa016ea61dd8d26dcd66603abb6f66d22a15bb5
add network creation call to network.api.API

Fix bug #1022470

Change-Id: Iccbbf086fb499e574c86a0f6ffceedfa07e1acf0
network manager returns empty list, not raise an exception

Fix bug #1023805

Change-Id: I9ddb10db127375ad37a7760b53e44782b392c2e3
Convert remaining network API casts to calls

Fix for Bug 1021340

During compute/terminate_instance networking is de-allocated by a call to
network/api/deallocate_for_instance(), which is implemented as an rpc.cast to
the network manager. This in turn will eventually call
network/manager/deallocate_fixed_ip(), which in turn call the compute API to
trigger a security group refresh, which will get the instance from the database

However because original call to the network manager is a cast there is a chance
that the compute manager will delete the instance record in the DB before the
compute API (in the network manager) tries to retrieve the instance. At this
point the security group refresh fails (leaving rules in place which are a
security risk when the IP is reused), and potentially stopping otheraspects
of the network deallocation from completing.

Changing this from rpc.call to rpc.cast will fix this issue.

Aside from this specific use of a cast there are 4 other casts in the
network API:
  add_fixed_ip_to_instance
  remove_fixed_ip_from_instance
  add_network_to_project
  release_floating_ip

and to avoid other timing issues these will also be converted to calls.

Change-Id: I5cdcc628293d3e7cf165c5ffe4883f138783f73f
Raise HTTP 500 if service catalog is not json.

Updates the Nova API auth middleware so that it returns a HTTP
500 error if invalid JSON is found.

Adds a unit test.

Change-Id: I236ced13bac2164e103060e78845a410ceb6cdd4
Change base rpc version to 1.0 in compute rpcapi.

A recent patch change the RPC_API_VERSION in compute/rpcapi.py to 1.1.
This change was the right thing to do in compute/manager.py, but not
compute/rpcapi.py.  This patch changes it back to 1.0, and changes the
code to only specify that 1.1 is required for the new method.

This version in the rpcapi modules is used as the default version to set
in a message.  The version sent in a message is the minimum version
required to be implemented on the manager side for the message to be
successfully processed.  For most messages, that is just 1.0.  In the
case of the new method, it's 1.1.

This patch also changes the name of his variable in the rpcapi modules
from RPC_API_VERSION to BASE_RPC_API_VERSION to help clarify this a bit
more.

Change-Id: I2bb4602845869bd44b39531eeb4f1e7c0c4c20c2
Adds snapshot_attached_here contextmanager.

This patch does three things:

    * Moves more code into vm_utils to better match our separation of
      concerns.

    * Reduces complexity of the vmops._destroy method.

    * Adds snapshot_attached_here contextmanager to make the
      snapshotting code a bit cleaner.

Change-Id: I544dc2ba203519d32a5ecce4a87157b5c4a55076
Remove VDI chain limit for snapshots.

Snapshots and migrations were coded with a simplifying assumption that
the maximum length of a VDI chain would be 3. Now that fast-cloning has
been added, this assumption no longer holds.

The goal of this patch is to remove the restriction for snapshots. A
follow-on patch will remove the restriction for migrations.

This patch changes the image-format for XenAPI images. Instead of naming
the VHDs, 'base', 'image', and 'snap', they are now numbered staring
with 0 as the leaf and going to N as the base-copy (root).

Old-style images are still supported.

Change-Id: Ieb073b42dc25db7cee4dfca7ff6525f7e7f46e8e
Merge "Remove deprecated auth from GlanceImageService"