VM in rescue state must have a restricted set of actions

Right now it is possible to pause, suspend and stop a VM in state RESCUED,
so after the state is changed, it's not possible to trigger unrescue anymore
since the original state is lost.

This patch remove vm_states.RESCUED as valid state from stop,
pause and suspend actions.

The vm_states devref is also updated to reflect this change including the
current reboot flow.( vm_states.RESCUED cannot be rebooted as per
today code)

DocImpact
Closes-Bug: #1319182
Co-Authored-By: Cyril Roelandt <cyril.roelandt@enovance.com>
Change-Id: I531dea5a5499bf93c24bea37850d562134dee281
Libvirt: Added suffix to configdrive_path required for rescue

It was observed that during nova rescue, nova failed to create
a rescue disk for disk.config. The reason being that .rescue
suffix was missing from the configdrive path. It was working
till Havana but the functionality broke in Icehouse. This commit
fixes the suffix problem.

Unittests have been added to verify following scenarios:
    1. Make sure that .rescue disks are created when not using
        config drive
    2. Make sure that .rescue disks are created when using
        config drive

Closes-Bug: #1334024

Change-Id: I87449ffddd047cb84b7b881757ea4c29927b95da
Fix virt BDM __setattr__ and __getattr__

Previously we would only allow these to work on fields that are found in
the _proxy_as_attr collection of the object and we would unconditionally
raise an AttributeError otherwise.

This behaviour is too restrictive as it prevents us from using mock on
these objects properly, Instead we now delegate back to the parent
class for a more natural behaviour.

Change-Id: I5c221eef8f05c66ac2e2fb4abf645748407462c0
VMware: support the hotplug of a neutron port

Nova already has support for hotplugging neutorn ports in the libvirt
driver. This extends the support to the VMware driver.

Implements the blueprint vmware-hot-plug

Change-Id: I01b78621016e20c8e61d48bdeeac166f08f799be
VMware: Remove unnecessary deepcopy()s in test_configdrive

test_configdrive was doing a deepcopy of its test_instance object in
some tests. This was unnecessary, as the object is created fresh in
setUp().

Also, change a couple of dict lookups of test_instance to object
properties.

Change-Id: I3a5039fde9f8fba5285d90b28743b7af8cd1a168
Minor tweaks to hypervisor_version to int

Follow up to I28ce23509e3c9feae183a49a8fc5bf3c7c601295. That path had a
few minor issues that weren't worth holding up the patch for. This patch
fixes those issues.

Change-Id: I878cb028e1dc48ad5182820d580fab609ba62db4
Sync loopingcall from oslo

This change syncs:

bc48099 Log the function name of looping call
ab5d5f1 Use timestamp in loopingcall
e377393 Changes calcuation of variable delay

Change-Id: Ie93695b2b76bc258922495911bc40c5aaf414a91
libvirt: define XML schema for recording nova instance metadata

Define an XML schema to be used in the libvirt guest config as
a metadata block to provide information about the instance
that is being run. When querying the libvirt guest XML this
is visible thus:

<domain type='kvm' id='6'>
  <name>instance-00000004</name>
  <uuid>a173eb64-f8e6-419b-a2b7-2d3283ecb26c</uuid>
  <metadata>
    <nova:instance xmlns:nova="http://openstack.org/xmlns/libvirt/nova/1.0">
      <nova:package version="2014.2"/>
      <nova:name>demo</nova:name>
      <nova:creationTime>2014-06-27 11:22:25+GMT</nova:creationTime>
      <nova:flavor name="m1.small">
        <nova:memory>2048</nova:memory>
        <nova:disk>20</nova:disk>
        <nova:swap>0</nova:swap>
        <nova:vcpus>1</nova:vcpus>
      </nova:flavor>
      <nova:owner>
        <nova:user uuid="18509018d00743c89518135e476003e0">admin</nova:user>
        <nova:project uuid="38bd8e984a3e435a87e950a441ee55aa">admin</nova:project>
      </nova:owner>
      <nova:root type="image" uuid="f0f0d38c-0a5f-4c54-83e5-d48006b888a7"/>
    </nova:instance>
  </metadata>
  ...snip...
</domain>

Blueprint: libvirt-driver-domain-metadata
Change-Id: I19432cb93bc1471118d9d323c712cdd9756a5926
Fix nova/pci direct use of object modules

This replaces all uses of nova.objects.<module>.<object> with
nova.objects.<object> within nova/pci and nova/tests/pci.

Change-Id: I72e763fb5032a5dc2cf649e5e29213ea71578c8d
Partial-Blueprint: object-subclassing
Add API schema for v2.1/v3 reset_server_state API

By defining the API schema, it is possible to separate the validation
code from the API method. The API method can be more simple.
In addition, a response of API validation error can be consistent for
the whole Nova API.

Partially implements blueprint v3-api-schema

Change-Id: Ib6bf4d1f1d875249d1758d4414377d47e15a3198
Check instance state before attach/detach interface

Currently there isn't any instance's status checking before
attach/detach interface, It will fail when some status didn't
support it. This patch add checking for it.

This patch allow attach/detach interface for ACTIVE, PAUSED
and STOPPED instance.

* ACTIVE: The interface is hotplug to instance.
* PAUSED: The interface can be hotpluged after instance unpaused.
It's fixed by commit: a868fcedf8e46070cae6aa8e59e61934fa23db1c
* STOPPED: In this status, the instance is destroyed. It just update
the instance configuration with new interface. When the start
instance, the instance will be recreated with new configuration.

Change-Id: I3c038056085be1f655758ed8b6a44bcdbf70cdd5
Closes-bug: #1299333
Merge "Add API schema for v2.1/v3 reset_server_state API"
Merge "Libvirt: Added suffix to configdrive_path required for rescue"
Merge "Fix virt BDM __setattr__ and __getattr__"
Merge "VM in rescue state must have a restricted set of actions"
Merge "Check instance state before attach/detach interface"
Merge "Sync loopingcall from oslo"
Merge "VMware: Remove unnecessary deepcopy()s in test_configdrive"
Merge "Fix nova/pci direct use of object modules"
Merge "Minor tweaks to hypervisor_version to int"