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
Removed copyright from empty files

According to policy change in HACKING:
http://docs.openstack.org/developer/hacking/#openstack-licensing
empty files should no longer contain copyright notices.
Please note, Oslo (nova/openstack/common) not changed!

Closes-bug: #1262424
Change-Id: I26b7d1eabb189f06219b70495d229389b9d3f260
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
Add UNSHELVING and RESCUING into IoOPSFilter consideration state

IoOpsFilter will take instance in following state
task_states.RESIZE_MIGRATING, task_states.REBUILDING, task_states.RESIZE_PREP,
task_states.IMAGE_SNAPSHOT, task_states.IMAGE_BACKUP
into consideration ,if the instance on this host exceed the maximum
number of instance allowed to do I/O the scheduler will fail on the host

UNSHELVING and RESCUING are also I/O related so IoOps need to include them

Change-Id: I141470254c824e7e57e6734ae0e016c432b85c00
Closes-Bug: #1295558
No longer any need to pass admin context to aggregate DB API methods

No longer need to pass an elevated context because the check of
admin has been removed in following patch:
https://review.openstack.org/67026

This patch removes the admin context elevated
method in nova/scheduler sub-folder since it's not required any more.

Change-Id: Ib768c97c9e84a9db44d866fa5fbfc4665ad7c73e
Partial-Bug: #1279216
Remove unnecessary passing of task_state to check_instance_state

Remove cases where task_state=[None] was passed to check_instance_state
when that is essentially the default value anyway

Change-Id: I49b6449b9ae43a5cfcf5a1ccac5ee9a64d2b3f3c
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
Nova utils: add in missing translation

The method validating the hypervisor version would throw
an exception that did not have a translation.

Change-Id: I6284d313a553757b90bd6b2c4946c6aa84ea17cd
Scheduler: remove test scheduling methods that are not used

The test code no longer uses the following methods:
 - fake_get_group_filtered_hosts
 - fake_get_group_filtered_affinity_hosts

This patch removes those methods.

Change-Id: I0a005fb1301ce78cc2ec365429015c08d58f446e
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
Fix AvailabilityZone check for hosts in multiple aggregates

Check for multiple AZ was distinct when adding an host to an aggregate
and when updating an aggregate (or its metadata), which was leading to
possible corner-cases where logics were different.

This patch proposes a single way for checking for both API methods and
also adds an extra control on the possibility to have an aggregate with
its metadata AZ set to the configuration default value (eg. 'nova') and
where it was possible to subsequently have one host in two disctinct AZs
Fixed that scenerio as it is a gap, Nova as of now preventing to have
one host in two distinct AZs.

Change-Id: Ida6aa507f34f36a436adaafe1f7609963c59a9bc
Partial-Bug: #1277230
Add specific doc build option to tox

Add doc venv to align with other OpenStack projects (such as keystone,
heat and nova-specs) who are using 'docs' for there doc builds.

Change-Id: I37771db339d864b2b938d1c02d15d38b07093493
VMware: remove unused variable

The flag was never used since it was added in commit
24d609447399e468937f8a278854690864ffabcd

Change-Id: Ia034ccff1220783c2dd8c37c76fce24063f12682
Ignore errors when deleting non-existing vifs

If an instance fails during its network creation (for example
if the network-vif-plugged event doesn't arrive in time) a
subsequent delete will also fail when it tries to delete the
vif, leaving the instance in a Error(deleting) state.

This can be avoided by including the "--if-exists" option to
the ovs-vsctl command so that the command doesn't fail if the
vif doesn't exist.

Change-Id: Ic613c9d6e0619f51fcd931e62f6d6bce404ebe81
Closes-bug: #1308544
Set the volume access mode during volume attach

cinderclient supports an optional keyword argument named 'mode'
for volumes.attach(), which allows you to set the access mode of
a volume at attach time. The keyword argument is not passed in
by nova when it attaches a read-only volume, making the volume
access mode default to 'rw' instead of the desired 'ro'. This
patch finds the access mode of the volume and passes it to
cinderclient, so the correct access mode is used at attach
time.

Change-Id: Ib62f454292e60114f96debbad96c4a356dc32a21
Closes-Bug: #1307088
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
Add new ec2 volume db API calls

The existing API calls for the EC2 volume ID mappings only returned
the EC2 ID or the UUID, not the full mapping.  We really want APIs
that return the whole mapping for use with a nova object.  This patch
adds those APIs which will be used by the VolumeMapping nova object.

Change-Id: I86361a557254dbddeae2ea49e986add813e5a934
Add VolumeMapping object for use in EC2

The EC2 code has a table mapping volume UUIDs to EC2 IDs.  This patch
creates the Nova object for this so that we can remove direct use of
these db.api calls from the EC2 code.

Change-Id: I80e5d9c8e33c1f0c5ef8a9f7c54935c8c329ed25