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
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
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
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
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
Add a docstring to hacking unit tests

This commit adds a docstring to the hacking check unit tests
explaining how the tests work. To someone who isn't well versed with
how pep8/flake8 works the tests cases are a bit of black magic.

Change-Id: I5dc61612a5fec42443d8d89eaf700bb17b4b0842
Fix the explanation of HTTPNotFound for cell showing v2 API

This patch adds the explanation to cell showing in v2 API, when
the cell is not found, the exception of HTTPNotFound will return
more infomation.

Change-Id: I25dee08a04ad974af5309999527e0f173d2c2cab
Closes-Bug: #1316152
Code Improvement

Change code in wsgi.py.

Before:
if not is_dict(body[entity_name]):
    return False
return True

After:
return is_dict(body[entity_name])

Since this calling is in the end of the method I
can just return the result of the calling.

Change-Id: I834f26aa5a91abd18b8da10aef81f3aeb72a61ed
XenAPI: Remove unneeded instance argument from image downloading

The Xenapi image downloading code requires an instance argument
when launching a VM.  However, the downloading code doesn't
need the instance information as it doesn't use it for
any processing/debugging/loging.  We can remove this
argument safely.

Change-Id: Id8b531b74e5f0e59638b608bff93fc89b66b889d
Closes-bug: #1307662
Fixes arguments parsing when executing command

A regression was caused by changing the eventlet.subprocess.Popen
with the builtin subprocess.Popen (by using the nova.utils execute
method) without changing the way the arguments were parsed.

In the v1 volume utilities module, the execution args were parsed
separated by whitespaces, which is not allowed by the builtin
subprocess.Popen, causing a "not found" error.

This error is returned for example when attaching a volume, at the
point where iscsicli tool is used to login the iSCSI target or portal.

This patch fixes the issue by simply splitting the args.

Closes-bug: #1317180

Change-Id: Iee7d5de0dde8b68d8f2bab4214e9b6779ad9f722
Updated from global requirements

Change-Id: Icb3c49781f2769698714d4fab9cbaed10ebe4251
Tidy up xenapi/volume_utils.py

Removed unused code and made some private methods start with _

Change-Id: Idae0bf55b9d0586fd0a0412aace517afc46031ea
Move tests into test_volume_utils

Move some tests in test_xenapi that would fit better in
test_volume_utils.

Change-Id: Ibe516a2473ff921d4f43621e71645810e674f73b
VMware: spawn refactor - phase 1 - power_on_vm

move power_on to vm_util and change all power_on in vmops to use it

ensure test_driver_api tests only the driver and not vmops

change id for the last review in this phase 1 series with a spawn
test is Ia137f1ea4b9fa43741cdd7d610831da8e5474d62

partial blueprint vmware-spawn-refactor

Change-Id: I5c1d8bc38c4a7d0107c8d7639e385239e53b070d