Fix logic for aggregate_metadata_get_by_host_with_key test case

After deleting a3 metadata, it is the host that once has such metadata
should be tested.

Change-Id: I79c40aa977911cd327d478ad8d9f147e19325017
Change parameters of add_timestamp in ComputeDriverCPUMonitor class

Change parameter 'cls' to 'self' in wrapper. 'cls' may mislead developpers
that this decorator returns a classmethod. Use functools.wraps to follow
the common pattern of decorator in nova.

closes-bug: #1288281

Change-Id: I6acbcba7297607dc6d07e8668ad07e6ca81d4456
Make sure leases are maintained until release

Dnsmasq asks nova-dhcpbridge for existing leases on reboot, but
we don't return addresses that have been deallocated but not yet
released. This modifies nova to return leased but not allocated
addresses. It also delays removing the vif until we disassociate
the ip so we still have access to the mac address.

Resolves-bug: 1300355

Change-Id: Id78d66aad5005f052a1b49002de0ef13ef5a298d
libvirt: optimize pause mode support

Commit bfb28fcf9031af4c695177663702ce05edbbfa4d added a method
call that checks if the libvirt driver support the
VIR_DOMAIN_START_PAUSED flag. This patch optimizes that by reading
the value at startup.

Change-Id: I0fc1edec55df609ab25b9999f4a0d077ddcf0be7
Add lock on API layer delete floating IP

There are potential race condition when multiple nova-api
service is running. We need to prevent the concurrent access to
the same floating ip, though db layer function is ok for floating
ip, the quota will be released more than one time and it will
lead to potential problem later

So the solution: check whether the db is *really* updated with the
value we want, which means the second operation will fail and
return None, so network api layer can handle it

Change-Id: I028938a4c387d21a8880ae168b161a763e7361ff
Closes-Bug: #1268569
Remove unused nova.crypto.compute_md5()

Remove nova.crypto.compute_md5() as it is:
 * unused
  * last user removed 3 years ago with commit bab3060
 * untested
 * incorrectly documented
  * return type is not a tuple, but a string
 * redundant
  * copied from boto which is a nova requirement
 * burdened with license text more verbose than associated code

Change-Id: Ia033d3359098fc0af8de00248dc14b4fe280e844
Support multi-version pydevd

We need to support multi-version pydevd
in order to supporting pycharm3 and pydev3 remote debug.
If we want to remote debug by pydev3 or pycharm3,
"from pydev import pydev" is not work,
need to "import pydevd" directly.

Change-Id: I975c859c46f81d7fe1ca3dfebe05040153471800
Delete in-process snapshot when deleting instance

Try to delete the image created to hold the snapshot when the snapshot
creation fails because either the instance doesn't exist or it is in the
deleting task_state.

Closes-Bug: #1296590
Change-Id: I422c4f10c348d189fee217b55e0766e73eb5b16c
Use strtime() specific timestamp regexp

Any datetime objects that get serialized via jsonutils.dumps() get
stringified using strtime() which includes decimal seconds and is
timezone naive.

Use a specific regexp to check the use of this format.

Note that included in here is a fixup to the doc samples for the
instance actions extension - the sample shows it using the
str(datetime) format when in fact it is using strtime. This came
about because before commit 68288b9 we were using a pre-serialized
timestamp in the fake instance actions. I just regenerated the samples
for this.

Full context here:

  http://lists.openstack.org/pipermail/openstack-dev/2014-April/033971.html

Change-Id: If52a2a664eccc8aed8a39d1a9dfb0209337c3c79
Remove quota-class logic from context and make unit tests pass

Continuation of quota-class removal started in
I1110022d6f628d03aaf363da707f2d2ef1600437.

Since we don't have an API to set quota-class any more, we don't need to
store it inside of the context. Also begin removing quota-class logic from
nova.quota to make test_quota pass with changes to context

Change-Id: I85dd24121a434b95dc6f0af180444d4258b50765
libvirt: Handle `listDevices` unsupported exception

It's possible that `listDevices` will return an exception if it's not
currently supported.

If this happens, the compute service will fail to start up.

The proposed solution is to catch this error, log a warning, and allow
the compute-service to continue initialization.

Change-Id: If152abd1080e9ba395de5d8ea10f5e0c476d4e2b
Closes-Bug: #1304721
Fix security group list when not defined for an instance

If an instance has an empty security group list an exception
is thrown due to iteration attempt of None.

To fix this, this patch modifies get_instance_security_group
to return an empty list instead of None.

Change-Id: I7efb3c3a58d7e20501d126c6d194479ca1d14166
Closes-Bug: #1291489
Revert "Address the comments of the merged image handler patch"

This file was added in a55bbbfa1957d02b3006a51afcf4984a1f8ff886 and
later fixed up in 9e8513e6fe4bf8a8759ad0c1d71594f952d920ad. Only the
first commit was reverted in 0ba9cca788309bd8763a0d277a907769604cd9f4,
this commit finishes the job and reverts the fix-up commit so that the
orphan imagehandler code doesn't linger and doesn't get in the way of
future changes.

This reverts commit 9e8513e6fe4bf8a8759ad0c1d71594f952d920ad.

Change-Id: I3cf8000a3e984c57441a226d3139acbf3e346825
Clean up openstack-common.conf

oslo-incubator will introduce new integrity check in [1].
That will help developer find inconsistent issue while copying
from oslo-incubator. The check just outputs warnings. These are
changes according to warning:
 * sort the modules in openstack-common.conf
 * Fix wrong module names

[1] https://review.openstack.org/#/c/76901/

Change-Id: Ie939d46a72732357acc9dab03c0682b0e271a7ed
Related-Bug: #1295582
Fix wrong used ProcessExecutionError exception

This class has been moved to nova.openstack.common.processutils,
but a wrong usage is exists in nova.virt.libvirt.volume,
correct here.

Closes-bug: #1308839
Change-Id: I76f99b63dc5097b462dcff6ff63cbbb13d7580fb
VMware: prevent image snapshot if no root disk defined

If there is no root disk defined then the snapshot should
throw an exception.

Change-Id: I0549b8ca9ba41b734277600cb66a74b27ca72d88
Related-bug: #1297605
Fix v3 API extension names for camelcase

Most v3 API names are camelcase, but few APIs are not.
This patch changes them to camelcase for the consistency.

Change-Id: I0dc6c23ffcdcf97fc52d3575d521692805ffd9e3
Closes-Bug: #1315597
Remove logging in libvirt _connect_auth_cb to avoid eventlet locking

The _connect_auth_cb callback is logging a warning if credentials are
passed to the method from libvirt when connecting, but the comment right
above where the connection method is called on libvirt, it says don't do
any logging in that function because it can cause issues with how
eventlet does logging.

This has probably never been an issue because libvirt hasn't passed
credentials back to the callback, but if it did at some point we could
have a nasty locking problem so let's clean it up now.

See commit e4b0d8e9 for some related history.

The nested method is moved up a level so it can be tested directly.

Change-Id: Ie47aabbf81c5aeda9e12e1c9acc11f6c70c4bea7
Make xenapi agent code use Instance object for updates

This makes the agent code use the Instance object that it is passed
to do the updates, instead of calling back to the old-style virtapi
instance_update() method.

Related to blueprint virt-objects-juno

Change-Id: Ied8891c974970a25f135a88303789d0c074741ee
Convert xenapi/vmops uses of instance_update to objects

This converts uses of the old instance_update() conductor method
to use the instance object in xenapi/vmops.

Related to blueprint virt-objects-juno

Change-Id: I5fab06934a7f3e7426631bb75eafe8b0d4b0806d