VMware: add tests for spawn with config drive enabled

Add tests for test_vmops where config driver is enabled.

TrivialFix

Change-Id: I6ca9bfb32672d42987892ee4e95c0d33c3ef2685
VMware: fix compute node exception when no hosts in cluster

Commit 4033c0c9c16d2844b36fd5627717e7ce206887f6 casues the
regression. The result was a empty string and not None.
That is suds returns a Text object and not None.

Change-Id: I79e70e300f40eb3561cf56478d578f0f8cda273e
Closes-bug: #1383305
Use wsgi.response for v2.1 API

Now a decorator @wsgi.response() can be used for specifying success
status code. Most v2.1 APIs use the decorator and it makes the code
more readable. This patch replaces webob.Response with the decorator
for the other APIs.
In addition, this patch changes some orders of decorators for showing
success code and expected error codes clearly.

Even if applying this patch, some webob.Response() calls still exist
under the path nova/api/openstack/compute/plugins/v3/ because these
cases need to contain some information in a response header.

Partially implements blueprint v2-on-v3-api

Change-Id: I419819b8e55427979e8d82b972cd237952a5b06b
Use common get_instance call in API plugins

Cleanup API to use common get_instance call which
automatically does exception handling. Not all cases
are handled in this patch as some require more
significant testcase rework and are done in future
patches to make it easier to review.

Change-Id: Id27350e6562636f81347b490db649744b6b41186
Delay STOPPED lifecycle event for Xen domains

When using libvirt, a reboot from inside of a kvm VM doesn't trigger
any libvirt lifecycle event. That's fine. But rebooting a Xen VM leads
to the events VIR_DOMAIN_EVENT_STOPPED and VIR_DOMAIN_EVENT_STARTED.
Nova compute manager catches these events and tries to sync the power
state of the VM with the power state in the database. In the case the VM
state is ACTIVE but the power state is something that doesn't fit, the
stop API call is executed to trigger all stop hooks. This leads to the
problem that a reboot of a Xen VM without using the API isn't possible.
To fix it, delay the emission of the STOPPED lifecycle event a couple of
seconds. If a VIR_DOMAIN_EVENT_STARTED event is received while the STOPPED
event is pending, cancel the pending STOPPED lifecycle event so the VM
can continue to run.

Closes-Bug: #1293480
Change-Id: I690d3d700ab4d057554350da143ff77d78b509c6
remove use of explicit lockutils invocation in tests

Instead of passing lockutils loading explicitly in the test run
command line, provide the support for individual test classes to ask
that lock_path is setup with the REQUIRES_LOCKING = True class
parameter.

Augment all classes that currently fail without this with
REQUIRES_LOCKING = True. Hopefully many of those can be individually
removed in the future so we can get out of needing external locking in
any of our unit tests.

Change-Id: I56229e93ad61ac823646a4119a035d36c3400173
Update docstring for check_instance_shared_storage_local

The check_instance_shared_storage_local method is getting
a nova instance object so update the docstring to reflect
that.

Part of blueprint kilo-objects

Change-Id: I2fe671f47bc73e5bf292abce7ba678e1cf59e6d9
Merge "Delay STOPPED lifecycle event for Xen domains"
Merge "VMware: add tests for spawn with config drive enabled"
Merge "VMware: fix compute node exception when no hosts in cluster"
Merge "Use wsgi.response for v2.1 API"
Merge "Use common get_instance call in API plugins"
Merge "remove use of explicit lockutils invocation in tests"
Merge "Update docstring for check_instance_shared_storage_local"