libvirt: virt rescue method now supports objects

Commit a37a96fd13b933123e80ad24e37fc37d73c16059 ensured
that the compute API and manager are now getting objects
for the rescue method.

This patch adds support to the virt driver code.

Change-Id: I2ae89f937b1983a2b0599e2eded343aa8358dbba
libvirt: virt unrescue method now supports objects

Commit 65ad230af5ece020822fa963dd30fd641a54ae91 ensured
that the compute API and manager are now getting objects
for the unrescue method.

This patch adds support to the virt driver code.

Change-Id: I5cca3fa997042b164c21fe2a13c2311f4b18ec06
Fix cold-migrate missing retry info after scheduling

If the resize failed, nova-compute will try to rescheduling this resize
task. But the retry info is missed at resize compute task. This patch
add the retry info back.

Change-Id: I1b60704955e2fb218d047394dd20afe7f971c03d
Make remove_volume_connection() use objects

Changes the remove_volume_connection() method in compute manager
to take objects.

Related to blueprint compute-manager-objects-juno

Change-Id: I4fabee87df409accd947db3d5b429f7e871c2d60
VMware: create utility function for reconfiguring a VM

A utility method has been created that simplifies the process of
reconfiguring a VM.

Change-Id: I184e2483726e29819164175493cfd1559592358b
libvirt: test setting of CPU tuning data

The setting of the libvirt guest <cputune> data from the
flavor extra_specs quota parameter was never tested. In
fixing this omission, it was noticed that the data was
incorrectly passed around as a string instead of an int.

Change-Id: Ie8b31feddf6c546eb05ca00ead5c56bcd535dd84
libvirt: introduce separate class for cpu tune XML config

Instead of just setting attributes against the main
LibvirtConfigGuest object, have a LibvirtConfigGuestCPUTune
object. This is more flexible when we have to add support
for further cpu tuning attributes.

Blueprint: virt-driver-cpu-pinning
Change-Id: Id3667752fcbbfe3e55ee221fd2cd364d5cfb2f80
vmware: remove unused delete_disk fake vim method

This is unused since the driver moved away from using DeleteVirtualDisk
in I786365847673e5192a21b654cba951b2e7a6f291

Change-Id: I126b4c069178720250f0dc7fcb924cd3c6c450e5
Fix run_instance() rpc method to pass instance object

Change I8a206f63cab1e4f939d2c97c258312a8fa540aff converted run_instance()
to use instance objects, but although it changed the rpc version to 3.27
it didn't update the rpcapi method, so at the moment it still passes a
dict.

Related to blueprint compute-manager-objects-juno

Change-Id: I0e511a5c4f1adce901f8812a935b98886c216dc9
Update compute rpcapi tests to use instance object instead of dict

Bugs such as 1327145 when the rpc code is accidentally reverted
to passing dicts instead of objects are not currently detected by
the unit tests because these are always called with a dict.

This change updates all compute rpcapi unit test cases to pass
an instance object to all cases where the version has been
converted to objects, so that such issues are now detected.

Related to blueprint compute-manager-objects-juno

Change-Id: I9b974e3a8e8e6dcbf87b1bdc854f05e94e7a35ce
vmwareapi: remove unused update_host_status method

The VMWare driver declares a method 'update_host_status'
which has no callers anywhere in the codebase.

This is left over code that was missed in the cleanup from

  commit 2cb47fbabf09ced76178e8453d508c66f86a7a3a
  Author: Arata Notsu <notsu@virtualtech.jp>
  Date:   Thu Oct 18 22:40:01 2012 +0900

    Remove ComputeDriver.update_host_status()

Partial-bug: #1333219
Change-Id: Ie0de9b6d427246cb3c3adb818d483b61dfb08d82
virt: add get_instance_disk_info to virt driver API

The compute manager has been calling get_instance_disk_info on
virt driver implementations during block migration, despite
this method not being declared in the virt driver API. It was
implemented in libvirt and stubbed in xenapi, with different
API signatures in both.

Declare & document it as part of the virt driver API, and
split the libvirt impl into two parts to hide the libvirt
specific notion of XML config.

Partial-bug: #1333219
Change-Id: I38c811f91cce99772ff988a278c32483a219949d
virt: use context & instance as param names in migrate APIs

The vast majority of methods in the ComputeDriver use
'context' and 'instance' as parameter names. The only
exceptions are the migration related methods which use
'ctx' and 'instance_ref'. Change the latter to be
consistently named with the rest of the file

Partial-bug: #1333219
Change-Id: I0457e3e70ee58a9cbfc69f8cfe675de0504cc781
virt: fix signature of set_admin_password method

The compute manager passes (instance, new_pass) to the
set_admin_password method, and the XenAPI driver impl
expects this pair of parameters. The ComputeManager
class, however, declares that it takes (instance, context,
new_pass=None). It makes no sense to default the new
password to None, when the only caller always passes
it, and the context parameter is never passed by the
caller either.

Partial-bug: #1333219
Change-Id: If656da4ef54a0425b9f50ef03af044b803b1afae
virt: add test helper for checking public driver API method names

The virt driver impls of ComputeDriver should only expose public
methods which are already defined by the ComputeDriver base class.
Any other methods should be prefixed with an '_' to indicate that
they are internal helperrs.

Provide a test helper method which the virt driver tests will
call to validate their implementation is in compliance with
the base class signature.

Partial-bug: #1333219
Change-Id: Ibc2369a5f90e09857da29810ac0707614b041d54
libvirt: make method signatures match parent class

Fix any inconsistencies in method signatures between the
libvirt driver impl and the ComputeDriver parent class.
Add a test case to prevent future regressions.

Partial-bug: #1333219
Change-Id: I221433273bd73bb84ed62c8579d45471ac65e1ef
xenapi: make method signatures match parent class

Fix any inconsistencies in method signatures between the
xenapi driver impl and the ComputeDriver parent class.
Add a test case to prevent future regressions.

Partial-bug: #1333219
Change-Id: Ie0be083c684d557c068f8e69a4f0fc38567a1864
ConfigDriveBuilder refactor for tempdir cleanliness

In looking to clean up excessive DEBUG logging, it became clear
that the logging in ConfigDriveBuilder was largely based on the
split logic that existed in doing fs opts in __init__ and then
also later in make_drive. This required a persistent tempdir, which
had to be manually cleaned up. It also meant a mandatory additional
config variable.

Refactor ConfigDriveBuilder to move all fs opts into make_drive,
deprecating the config variable in the process. In doing so, I don't
believe the previous debug logging is useful any more. However, in
case, add a __repr__ for ConfigDriveBuilder that will provide us with
a reasonable debug representation in case this becomes part of what
gets thrown.

Tests are now adjusted to not call private methods, but instead call
make_drive with config variable set.

Change-Id: I1aaf194fef00edd6eecf73b5bb9323e0e3a6f09f
VMware: validate that VM exists on backend prior to deletion

Attempting to delete an instance that does not exist on the backend
throws an exception (for example UnregisterVM may return this when
running the CI).

Change-Id: I1b95caec2dad6580db576aa6f80f47913b7c066e
Closes-bug: #1300788
sync policy logging fix from incubator

This change syncs in a delete of an extremely verbose tight loop
debug message in policy.py that generated 8 additional lines for
every wsgi call.

Changes:

238e601b Make policy debug logging less verbose
9c88dc31 file_open: fixed docstring to refer to open() instead of file()

Change-Id: Ifd3f139ebabec9db4a645cd092a810ab22f5085e