Re-attach volumes after instance resize

Fixes bug 1051600.

Update the compute manager to pass block_device_info to three
additional driver entry points and update all virtualization drivers
to accept it as an optional argument.

Within libvirt, migrate_disk_and_power_off() will now iterate and disconnect
any existing connections.  finish_migration() simply updates its use
of to_xml(), passing block_device_info, which returns a libvirt XML
fully populated with volumes.  Finally, finish_revert_migration() no
longer uses the on-disk XML file, instead generating it via to_xml; as
the former lacks volume configuration.

Change-Id: I7dccd03ef9cc7d2848f07764d4def3787e41e202
Fixes snat rules in complex networking configs

There is currently no way to disable nova's snat rule, which causes
problems for some network configurations with an external gateway.
This patch allows the snat to be completely disabled by setting
a blank value for routing_source_ip.

This patch also makes the snat rule a little more specific, only
snatting traffic that is destined for the public interface (or
the floating interface if it is defined). This allows the snat
to work without changing routing_source_ip and also ensures that
an instance assigned multiple ips from different floating pools
will connect from the appropriate address for each pool

Fixes bug 1048765

Change-Id: I18be88a3dbb7a9f4762db7beefc94e07b8310100
Added description of operators for extra_specs

There are several new operators added for extra_specs that are used
in compute capability filter and aggregate filter. These are
described in document in this patch. Fixed bug 1047036.

Change-Id: Id86c6672d7bda458ecb918f1900d6f8a9526ad41
workaround lack of quantum/nova floatingip integration

bug 1040956

The Nova/Quantum integration in Folsom does not yet proxy Nova
floating IP calls to Quantum.  However, Horizon automatically
makes calls to Nova to list floating IPs, which prior to this
patch resulted in a Horizon error message due to the fact that
the Quantum integration code in Nova would raise an Unimplemented
error.  This patch changes that behavior to instead return an
empty list.

This is a workaround for Folsom.  The correct long-term behavior
is either to:
1) have Nova proxy all floating-ip calls to Quantum when quantum
is enabled.
2) have Horizon use the Quantum floating-ip API when Quantum
is enabled.

Change-Id: I5414d935e872a9da108511b50e70545d82b73347
Includes sec group quota details in limits API response

Added the security groups quota details to
the limit API response so that these details
also get displayed to the user.

Fixes bug 1049578
Change-Id: I45c345141747f99359c8948e959030f8cb99e866
Add entity body validation helper

Add a _valid_body() helper for the servers API to avoid repeating the
same tests in multiple methods. Include a check that the 'server' value
is actually a dict.

Also remove the superfluous checking of req.body which is a leftover
from when the body wasn't a method parameter.

Change-Id: If8114cc76d68567005c85c803f29e30e034db89a
Remove useless _get_key_name() in servers API

This no longer does anything useful. Firstly, we already check that the
body dict has a server key. Secondly, AttributeError will never be
thrown here since we have already checked that the entity is a dict.
Finally, we don't need to set this key to None if it's not supplied
by the client since we later use get() to to look it up.

Change-Id: I4235117cc47e5b5cbdad4425edb3c7059e608d49
Make compute/manager.py use self.host instead of FLAGS.host

This prevents the instances returned from getting a different
instance['host'] than was supplied to the manager. This shows up
during integrated testing of 'resize'.

Change-Id: Ifa4316bf7099dc2c60c4e87cfaafa93a4bc2e5b1
Imported Translations from Transifex

Change-Id: Ibcf44205f71393d3663e2479f5e63a8ac54861a1
Add README for doc folder

In preparation for more more man pages

Change-Id: I55a9d332e5cbba90ff1e2a2cb0c0d24ae35fba5b
Clean up handling of project_only in network_get

There was some funky logic for getting networks to work around
the project only decorator. This changes the code to match what
we actually want which is:

In Flat and FlatDHCP mode non-admins should be able to access
networks that belong to their project or networks that have no
project_id assigned.

In VlanManager, project_id=None projects should not be accessible
as this means the project hasn't been assigned yet. The assignment
is done with an elevated context.

This patch adds some logic to model_query to allow None in the
project_only filter and makes network_get_all_by_uuids and
network_get use it.

fixes bug 1048869

Change-Id: I5377cea87dec8e9d0d9cec84e07128c5c6e8dca3
Corrects use of instance_uuid for fixed ip

Uses instance_uuid rather than instance_id since commit 66f9e085a.

Fixes bug 1050417.

Change-Id: I6161c7a6ad9c3891e100daae39fe8ea82bfd8654
All security groups not returned to admins by default.

Fixes bug 1046054.

Previously security groups relating to all tenants were returned
when requested by an admin user.

Now only those groups related to the current tenant are returned
by default.

To recover the old behaviour, the all_tenants search option may
be specified via the native API with:

  /v2/<project_id>/os-security-groups?all_tenants=1

or via the EC2 API with:

  Action=DescribeSecurityGroups&Filter.1.Name=all-tenants&Filter.1.Value.1=1

Note that the latter is slightly ultra vires with respect to the
EC2 API spec, in the sense that this filter is in addition to the
standard set. Since we don't pay attention to many of these standard
filters as yet, this stepping slightly off-piste is deemed worth it.

Change-Id: I6157e408394d04096d21747d665e3b3aa6aa55de
Fix XML deserialization of rebuild parameters

This picks up the following attributes which are currently ignored
when poking this via XML:
 - accessIPv4
 - accessIPv6
 - adminPass

Change-Id: I947aa2f942022d839919ae7516759955e5b06668
Add api_samples tests for servers actions

Change-Id: I67446ccd53c83b5fcfc3a1857a10e160263834dd
Sync a change to rpc from openstack-common.

This commit pulls in the following change from openstack-common:

    ee44222 Change the qpid_heartbeat default to 60 seconds.

Fix bug 1050661.

Change-Id: I42acdca42f27fbbe9a52441f8cf7ea8261fd8d24
Add security groups extension to API samples test.

Change-Id: Ie7635cacf96e0bafbd412ff40d7912aa0da4677d
Signed-off-by: Matthew Treinish <treinish@linux.vnet.ibm.com>
Allow older versions of libvirt to delete vms

Libvirt < 0.9.4 doesn't support undefineFlags, so the vms can't be
deleted. This patch adds a workaround to fallback to the old style
of undefine if undefineFlags throws an Attribute error. It also
attempts to remove any managed save images that exist.

Fixes bug 1051010

Change-Id: I155fe2ab3be347b1515c5aab4a9233921bd722ca
Merge "Allow older versions of libvirt to delete vms"
Add admin actions extension

The optional os-admin-actions extension adds new wsgi_actions to the
volumes/action resource and a new snapshots/action endpoint.

With this extension both controllers will support an os-reset_status
action to force a database update of a volume or snapshot that is stuck
in a failed/incorrect status. The os-reset_status action works
similarly to the compute api's os-reset_state action for instances.

The os-force_delete action behaves similarly to the "cinder-manage
volume delete" command and allows operators/admins to retry the delete
operation after it has gone into an error_deleting status with an admin
api call.

The os-admin-actions extension is enabled by default, but limited to the
admin api by the default policy.json rules. Individual admin actions
can be disabled with policy rules as well.

Example of os-reset_status action on a volume:

curl http://localhost:8776/v1/${PROJECT_ID}/volumes/${VOLUME_ID}/action \
    -H "x-auth-token: ${ADMIN_AUTH_TOKEN}" \
    -H 'content-type: application/json' \
    -d '{"os-reset_status": {"status": "error"}}'

The new admin only api can assist deployers who encounter bugs or
operational issues that result in failed actions.

It can also be used by future storage backends to support async callback
style status updates from long running actions or operations which have
encountered an error will be retried.

Also updates the api.openstack.wsgi.ControllerMetaclass to support
sub-classing wsgi.Controllers that define wsgi_actions.

Partial fix for bug #1039706

Change-Id: If795599d5150dea362279d75a75276f3166d0149