Nova network needs to take care of existing alias

Nova network should take care of existing aliases on bridge
interfaces when it adds address on top of the list.

Change-Id: Ife54c9eba64906406f7c44a66b596f3162ad16b6
Fixes: bug #1077066
Rework instance actions to work with cells

In a cells setup an instance action is recorded at the global cell level
while events try to get recorded in a child cell compute node or
scheduler.  The event recording fails because it can't find an action to
link to.  This patch adds the recording of actions at the child cell
level, and changes the API extension to query the db in a child cell for
the record of actions and events.

This does not address the fact that an action is recorded at the global
cell level.

Bug 1132935
Change-Id: I5831f146397e7afa2d93d26c5d6f9abb9bc6670d
Fix ephemeral devices on LVM don't get mkfs'd

Fixes bug 1083424

Updated imagebackend to run the necessary callback conditionally
based on whether LVM is configured for use and ephemeral_size is
defined. The callback function was updated not to invoke qemu-img
for LVM, since the ephemeral disk is already present/created via
LVM. Lastly, the mkfs call had to be changed to be run as root,
since we are dealing with raw devices.

Change-Id: Ieb1febb0ea086f8e5063d92ca376d349fcd43a43
Updating powervm driver snapshot with update_task_state flow

Fixes bug 1136359

Without this change snapshot still works but instance task state
does not get updated correctly and nova logs will show expected
task state erros from compute manager.

Also added a snapshot test.

Change-Id: I0f4ed24aa82a66fafc4b6813d017618ae07b4751
Read baremetal images from extra_specs namespace.

Baremetal PXE driver should read deploy_kernel_id & deploy_ramdisk_id
from the 'baremetal:' namespace within instance_type['extra_specs']
so that it doesn't conflict with ComputeCapabilitiesFilter any more.

Fixes bug 1129485.

Change-Id: I84b3acb2ed83dc2b1ff8f1a21ca1d95f7d25751a
Fix Network object encoding issue when using qpid

When creating network via REST API will throw the exception
"CodecException: no encoding for
<nova.db.sqlalchemy.models.Network object at 0x4a8ea10>".
It only occurs when using qpid.
Fix this issue through using jsonutils.to_primitive method.

Fix bug 1143584.

Change-Id: I833aef451f8e3d5eaa246c19d67b2474a9d36910
delete deleted image 500 bug

Fixes bug 1138666

When you delete an image that you just deleted, you get a 500 Internal Server Error.
In this case, the problem isn't an internal server error but the "unauthorized" response
from the image service is not expected.

This can be recreated with devstack:
 1) delete an image
 2) delete the same image

Here's an example:

$ nova image-list
+--------------------------------------+---------------------------------+--------+--------+
| ID                                   | Name                            | Status | Server |
+--------------------------------------+---------------------------------+--------+--------+
| caa6c969-0f32-466b-8e8e-a7e0ac835470 | cirros-0.3.1-x86_64-uec         | ACTIVE |        |
| 8af603da-b69f-49c6-8e52-25632eccb31c | cirros-0.3.1-x86_64-uec-kernel  | ACTIVE |        |
| fe67d4e1-baca-4968-8638-2314373b620b | cirros-0.3.1-x86_64-uec-ramdisk | ACTIVE |        |
+--------------------------------------+---------------------------------+--------+--------+

$ nova image-delete caa6c969-0f32-466b-8e8e-a7e0ac835470

$ nova image-delete caa6c969-0f32-466b-8e8e-a7e0ac835470
ERROR: The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-1254f8a5-8dda-444a-a077-2072ab3baa6a)

If you delete a deleted image, the server should respond with '403 Forbidden'
because the image still exists and no user is allowed to delete a deleted image.

The fix is to catch the exception from the image service and
convert it to a wsgi exception for '403 Forbidden'.

Change-Id: I2f14687d5468b67389f5dd6ab338ceb54e8a29bb
Don't traceback in the API on invalid keypair.

When trying to get a keypair that did not exist, a traceback would end
up in the nova-api log.  Handle this exception in the API extension so
that it doesn't make a mess of the log.

Also add a unit test for this particular scenario.

Fix bug 1145545.

Change-Id: Id1647d4ac56629c2931099320d271e34fc2f99b9
Fix issues with re-raising exceptions.

There is complication with re-raising exceptions and our usage of
eventlet.  If the code in the exception handler accesses the db or rpc
in the exception handler, it will no longer be able to re-raise the
exception.  Using excutils.save_and_reraise_exception() works aorund
this issue.

The most common error is calling LOG.error() or LOG.exception(), as it
is possible for these to go access rpc.  There is an option to turn on
notifications for these errors.

Fix bug 845866.

Change-Id: Icfca2af63805711229249aa7abe60a938edd1b35
Add missing action_start if deleting resized inst.

When trying to delete a resized instance Nova will automatically
call confirm on the resized instance to help clean things
up. With some of the recent action event changes in grizzly this
code path was broken due to a missing record_action_start
call on the confirm_resize operation.

Fixes LP Bug #1147387.

Change-Id: I23e84de8675c980656a71b71e34ffa0a0801f389
Remove parameters containing passwords from Notifications.

compute.manager methods often takes password parameters in methods
that are wrapped with exception handlers and notifiers. What can
happen is these passwords will get bundled up and sent outside of
the system.

This patch will strip out any parameter with *_pass* in the name.

The side effect of this is that all notification will have the
error parameters in the 'args' part of the notification payload.
Previously only the positional args were in the 'args' part and
keyword args were placed in the payload directly.

This may affect consumers of the error notifications.

Change-Id: I2e7822eb5416d315ceb690f739e4dba9d52a7954
Fix instance_system_metadata deleted columns

Migration 153 adds instance_type data to sys_meta, but creates entries
with the default value of deleted.. which is NULL.  This means these
entries do not get pulled in on a join when querying an instance, as
there is a condition of deleted=0.

This converts 'deleted' NULL entries to be 0.

Fixes bug 1147839

Change-Id: I3caf92b3992b22089a2653c2e7220585d616a102
Fixed image filter support for vmware

The vmware compute driver does not support the image filter
based on hypervisor_type. In a heterogeneous environment,
this filter attribute allows us to provision an instance
to a specific hypervisor based on the property of the
glance image. The solution is to populate the dictionary
'supported_instances' from the vmware compute driver.

Fix for bug 1131542

Change-Id: I6ebf9f0d4a17b3083f66f69f077f910552d9a951
Merge "Remove parameters containing passwords from Notifications."
Merge "Updating powervm driver snapshot with update_task_state flow"
Merge "Fix issues with re-raising exceptions."
Merge "Don't traceback in the API on invalid keypair."
Remove uses of instance['instance_type'] from xenapi driver.

Note that this includes a fix to tests/db/fakes.py to make the fake
instance_type structures look like the database models.

This is one change in a series aimed at removing the use of instance-linked
instance_type objects, in favor of the decoupled type data in
system_metadata. See bug 1140119 for more details.

Change-Id: Ieb107fbaf0f3b5a42681aefc0ffdefdb8c0f98a5
Merge "Fix instance_system_metadata deleted columns"
Remove uses of instance['instance_type'] from powervm driver.

This is one change in a series aimed at removing the use of instance-linked
instance_type objects, in favor of the decoupled type data in
system_metadata. See bug 1140119 for more details.

Change-Id: I885a807d00f7f909665da6e7a3382295a43258c9