VMware: remove unused variable

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

Change-Id: Ia034ccff1220783c2dd8c37c76fce24063f12682
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
ec2: create volume mapping using nova object

Update the EC2 code that creates a mapping in the db between the
volume UUID and an EC2 ID to use the nova object for this.

Change-Id: I2b02c9f639519a7835ffcf27be704b4810334e6d
ec2utils: Use VolumeMapping object

Update ec2utils to use the VolumeMapping object instead of direct db
API calls for getting the ec2 ID to UUID mappings.

Change-Id: Id653fc16fffc1c416379087228a0b053b8868cac
Add warning to periodic_task with interval 0

The behaviour of Oslo's @periodic_task decorator is that
a repeat interval of 0 means that the method will be
called regularly.  Several Nova methods which use that
decorator also have code for returning early (ie no-op)
if the interval is 0.  This is inconsistent for users, and
means there is timing-related code where it doesn't belong.

This patch adds a warning when a user takes a value of 0
from config and uses it as an interval in a @periodic_task.

Ideally all code will use Oslo's convention that 0 means
run at the default rate and a negative interval will mean
"don't run".  After this warning has been in place for a full
release cycle that can be the case.

Change-Id: Ia227f4c4e69ecf361ab02d1d17a3010303650104
DocImpact: Warns of upcoming change to behaviour when
           *_interval is set to 0
Closes-Bug: #1272830
Partial-Bug: #1276203
Remove unnecessary wrapper for 5 compute APIs

There are 5 APIs in compute layer:
check_instance_shared_storage
change_instance_metadata
add_fixed_ip_to_instance
remove_fixed_ip_from_instance
reset_network
has unnecessary wrapper, this patch removed them

reverts_task_state is a wrapper to restore instance task state
when some thing wrong in executing the task,
change_instance_metadata, add_fixed_ip_to_instance
remove_fixed_ip_from_instance, reset_network doesn't change the state,
so no need to wrap it

wrap_instance_fault is a wrapper to catch the exception related to
instances, check_instance_shared_storage is not related to it

Change-Id: I2c4779c01854c2c8bac40e7379ad2fc4d0a7478a
objects: restore some datetime field comments

The datetime coercion code in nova.objects.utils had a couple of
helpful comments which were lost when the code was refactored into
nova.objects.fields.

Change-Id: If23320dd8780a1947ad4d5946c55e1e8794b782f
wrap_check_security_groups_policy is already defined

Removes the local method 'wrap_check_security_groups_policy' to
the module neutron_driver.py - This method is already defined
in compute_api.

Change-Id: I008326f7b77515a0fc878befe45fe705420835ad
Closes-Bug: #1314548
xenapi: fixup agent tests

The root cause of the slow agent tests was not mocking this method:
compute_utils.add_instance_fault_from_exc

This cleans up the tests to share a bit more code, and ensures they
actually check that the appropriate exception is raised.

This change adds a log message to report errors that could occur in
running systems that also helped identify this issue in the unit tests.

test_spawn_fails_agent_not_implemented was a duplicate test and has been
removed.

Change-Id: I6fd31520fffd5e888ce0c2b58af2715f0d929ce1
Closes-Bug: #1279317
Merge "VMware: remove unused variable"
Merge "xenapi: fixup agent tests"
Merge "wrap_check_security_groups_policy is already defined"
VMware: spawn refactor - phase 1 - execute_create_vm

Moves the inner function "execute_create_vm" from the spawn method
to vm_util. Additionally, return the vm_ref after VM creation so
an extra call to retrieve the vm_ref does not need to take place
after the fact.

partial blueprint vmware-spawn-refactor
Co-authored-by: Tracy Jones <tjones@vmware.com>

Change-Id: I67c3c8c14b6c01b160611cc001d51f1da29ffb24
Merge "Add warning to periodic_task with interval 0"
Optimize validate_networks to query neutron only when needed

This patch optimizes validate_networks so that it only queries neutron
when needed. Previously, this method would perform an additional net_list,
list_ports, and show_quota regardless if a request contains only
port_ids. If a request only contains port ids we do not need to check neutron
for quota as these ports are already allocated.

Change-Id: Ia7abc7d95b663f165fc95385dda3bab13b7a43e6
Closes-bug: #1291565
Merge "VMware: spawn refactor - phase 1 - execute_create_vm"
Merge "Add VolumeMapping object for use in EC2"
Merge "ec2: create volume mapping using nova object"
Merge "ec2utils: Use VolumeMapping object"
Merge "Optimize validate_networks to query neutron only when needed"