Disallow resize if image not available

If a resize is attempted on an instance that was started from an image
that has since been deleted, a resize will fail. This change makes error
reporting a bit cleaner.

This change is needed since in order to actually properly support
resize/migrate when the image is deleted - it is necessary for nova to keep
a copy of the image metadata and re-use it in case of migration/resize.

Fixes bug: 1160773
Fixes bug: 1177001

Change-Id: Ifaea71f79c97046a4cde094e3a5e676772fcceb4
get_instance_security_groups() fails if no name on security group

The following patch fixes a bug in get_instance_security_groups() where
it tries to access security_groups['id'] but security_groups is a string.
This patch also removes some stubs that were not needed in a few unit test.

Fixes bug 1182738

Change-Id: Ia64db2e40d4a0e163344b4234112dbde71b1e132
Move ImageTooLarge check to Compute API

The existing ImageTooLarge check is in the compute manager, meaning that a
validation error puts the instance into an ERROR state without the ability to
communicate the fault back to the user.

This patch moves the check to the API where we can return the appropriate
error to the user.

Change-Id: I2183449351e3b70f98d0552ea247184a3641d85a
Remove ImageTooLarge exception

InstanceTypeDiskTooSmall and ImageTooLarge are really two sides of the same
coin; an image is larger than the root_gb of the instance_type. Rather than
have two exceptions for this, this patch consolidates down to just
InstanceTypeDiskTooSmall.

Change-Id: I401205072c111a960beb2932c6c1889141ae03c3
xenapi: Disable VDI size check when root_gb=0

Nova uses root_gb=0 to indicate that we should use the image as-is without
trying to resize the root disk. Currently the xenapi virt-driver doesn't
properly implement this behavior.

This patch gets us a step closer by disabling the VDI size check when
root_gb=0. We still need to ensure that the disk-resize code handle root_gb=0
as well.

References bug 1155113

Change-Id: If91963e079e197a1315c48b8643f3419b42b0b2c
xenapi: Moving tests under tests/virt/xenapi/

We have both a tests/xenapi/ and a tests/virt/xenapi/ directory which
is confusing. This patch standardizes on tests/virt/xenapi/ which
matches the nova/ directory layout.

Change-Id: I324a4730e2477aa1863b17c7ea404ce2932a681c
Reset task_state when resetting vm_state to ACTIVE

A virt driver can raise InstanceFaultRollback to indicate that the
instance should be reset to ACTIVE.  However, the code that resets to
ACTIVE does not reset task_state to None.

This patch fixes that.  Technically, there's currently no bug here,
because the compute manager methods that matter here all have the
reverts_task_state() decorator to always reset task_state to None on
exceptions.  However, a bug would be introduced later if we remove
those decorators.

Change-Id: Ibcf8ae3473f601781d8aae80f88df3da54bbaac8
Make a few places tolerant of sys_meta being a dict

This will be necessary as we start to introduce objects with
real dicts in system_metadata. These are the common spots that
need to be ready ahead of time. The rest are at the actual use
sites and can/will be replaced when individual uses are
converted to objects.

Related to bp/unified-internal-objects

Change-Id: I8314e0d52ec2ae800765f60ce58ce9b309d7d513
Importing correlation_id middleware from oslo-incubator

Including 'correlation_id' middleware from oslo-incubator.
Adding this to openstack-common.conf to copy over the middleware to
the location nova/openstack/common/middleware

Change-Id: I21b27e8dae585345d03d59c125d9e1bbea95f830
Implements: blueprint cross-service-request-id
Remove locals() usage from nova.virt.libvirt.volume.

Change-Id: Idda3c0c447bd1f6394805cd6230a32dc22bb6268
Delete a quota through admin api.

Added 'extended-quotas' extension that has provides ability for admins
to be able to delete a non-default quota (absolute limit) for a tenant,
so that tenant's quota will revert back to the configured default.

Implements blueprint admin-api-for-delete-quota
Change-Id: I7375420a466823b3e099aebff71a8f7d7f922afb
Fix UnboundLocalError in powervm lvm cleanup code

During spawn, if a local volume for the backing block device fails to
be created, the cleanup operation for the volume can fail with a
"UnboundLocalError: local variable 'disk_name' referenced before
assignment" error.

The fix is to assign to disk_name earlier and check for None before
running cleanup.

This patch also adds tests to cover the failure case.

Fixes bug 1180955

Change-Id: I0f32df1586d7bd87eccb674fec2a9597b1ce351d
Merge "Remove locals() usage from nova.virt.libvirt.volume."
Merge "Move ImageTooLarge check to Compute API"
Merge "Remove ImageTooLarge exception"
Merge "xenapi: Disable VDI size check when root_gb=0"
Merge "xenapi: Moving tests under tests/virt/xenapi/"
hyperv: Move tests under nova/tests/virt/hyperv

Change-Id: Ia4ea16e5aa4a48e1f10a52394f7b59fdfdb68d54
vmwareapi: Move tests under tests/virt/vmwareapi/

Change-Id: I9665c650cc41c8dc1f3983ad85fdac9ebddc52d0
virt: Move generic virt tests to nova/tests/virt/

In the interest of better organization, this patch moves generic virt testing
code into nova/tests/virt.

Change-Id: I79473726a848f0abbcb13865efe30e02aea09ae5