Fix Trusted Filter to work with Mt. Wilson `vtime`

The Trusted Filter expects that `vtime` is returned from the
attestation server in an ISO8601 format, but the Mt. Wilson
attestation server can return it in a locale appropriate string format
instead. There's no way to configure Mt.  Wilson to do the right thing
so we should just try to parse the returned `vtime` as a string
formatted date.

Closes-Bug: #1353029

Change-Id: Ic7351e0463c014321bdb4fcfeba90ac51460b325
Add unit tests for libvirt domain creation

Tests for:
nova.virt.libvirt.driver.LibvirtDriver.get_guest_config
nova.virt.libvirt.driver.LibvirtDriver._create_domain

Partially implements: bp libvirt-lxc-user-namespaces

Change-Id: I4aada9ac06cd423b04a4c6136165c65e64e378aa
Use flavor in confirm-resize to drop claim

Current the confirm_resize() clean the stashed instance_type information
before invoking the drop_resize_claim, and the drop_resize_claim() try to
fetch the old instance_type in system metadata, which will be wrong.

We change the _cleanup_stored_instance_types() to pass back the
to_be_dropped instance_type, and use that information for drop_resize_claim.

Change-Id: Iba36acc75d3840104746596977b33bcd4e010f2e
filter: add per-aggregate filter to configure max_io_ops_per_host

Adds a filter AggregateIoOpsFilter whichprovides the ability
to read from aggregates metadata "max_io_ops_per_host".

DocImpact
Implements: blueprint per-aggregate-max-io-ops-per-host
Change-Id: I086033e7904c16995298bee7196ad3e7b5dc7aaf
Fix NotImplementedError in floating-ip-list

A list of existing floating IP (nova floating-ip-list) fails
when using VMwareVCDriver/LibvirtDriver and nova-network.
The following error is thrown: "NotImplementedError: Cannot load
'instance' in the base class". The problem is caused by
_normalize_ip, which tries to set an 'instance' field in
FloatingIP that is needed by _translate_floating_ip_view. The
instance is derived from the FixedIP that is assigned to the
'fixed_ip' field in FloatingIP. However, FixedIP may not have
an 'instance' field set, which can cause the NotImplementedError.

The following patch removes _normalize_ip and assigns the
'instance_id' required by _translate_floating_ip_view to
the 'instance_uuid' in FixedIP, since only the instance ID
is required and not the entire instance object.

Change-Id: I2d7937e969bd87e53557842a22f3861f0d307b5e
Closes-Bug: #1356051
Add graphviz to list of distro packages to install

Commit a507d42cf5d9912c2b3622e84afb8b7d3278595b makes the
doc builds fail on warnings, so people are probably going
to be running 'tox -e docs' more often. To run that you
need the graphviz package from the distro, so add it to
the list of packages needed when setting up a development
environment.

Change-Id: I47ffe63fddfbbd73c3fc698490ad07235caaf459
Closes-Bug: #1356983
Raise Not Implemented error from V2 diagnostics API

In case any driver does not implement functionality of providing VM
diagnostics, HTTPNotImplemented error will be raised from driver.
Nova V2 API should catch the same and pass it with proper error message
for better debugging.

This patch catch & raise  HTTPNotImplemented exception for
V2 "os-server-diagnostics" API.

Adding UT also for the same.

Change-Id: I485d3487d01eba07e3c34f6ef9b5c707af54ebb7
Raise HTTPNotFound error from V2 cert show API

There might be possibility of not having the CA file while
requesting certificate show API. API should raise HTTPNotFound
for clear error.
This patch raise this exception for V2 API. This has been fixed in
V3 API.

Adding UT also for the same.

Change-Id: Iafb33fce6433a31f9767067bbc45b95acd4ee511
VMware: Remove unused variable in test_configdrive

TrivialFix

Change-Id: I3b4c55f22e515d9a66311e4c608febf617babc5a
VMware: Create VMwareImage object for image metadata

This change pulls the nested function _get_image_properties() out of
spawn() and makes it a factory method for the new VMwareImage object.

Linked clone logic is moved from a separate function in vmops.py to
the new get_image_properties() function.

vmware_images.get_vmdk_size_and_properties() is no longer used, and is
removed.

Tests have been updated and/or moved as appropriate. No tests have
been removed.

This change has been split out of
https://review.openstack.org/#/c/87002/, which was written by Shawn
Hartsock.

partial blueprint vmware-spawn-refactor

Co-authored-by: Shawn Hartsock <hartsocks@vmware.com>
Change-Id: I580f173da798318d2675c7c70bbdd19b266259f4
VMware: Remove references to ebs_root from spawn()

spawn() contained an important boolean called ebs_root. This was True
for any spawn which contained a block device mapping. This no longer
has any meaning, and was confusing. This change removes references to
ebs_root, instead using block_device_info directly.

N.B. The block device mapping behaviour of the VMware driver is still
not correct, but fixing it is not the purpose of this patch. This
patch simply makes the existing behaviour easier to see.

N.B. test_spawn_mask_block_device_info_password in test_vmops.py
assumes internal details of spawn in order to cause a failure after
emitting a log message. In moving the log message we need to update
the dance this test does to ensure that spawn fails after the log
message, but not before.

This change has been split out of
https://review.openstack.org/#/c/87002/, which was written by Shawn
Hartsock.

partial blueprint vmware-spawn-refactor

Co-authored-by: Shawn Hartsock <hartsocks@acm.org>
Change-Id: I11b355a6b53194bc9f85f542b54c9fbb9c061e04
VMware: Create fake VM with given datastore

FakeVim._create_vm() was creating a VM with a default datastore rather
than the given one. This prevented testing that the correct datastore
has been used.

Change-Id: I640a21f23b2d5c1186772c8c5ce3ca8927e6cbc5
VMware: Fix type of VM's config.hardware.device in fake

config.hardware.device was handled inconsistently, and could be of
various types. When created by _create_vm(), it was actually a
VirtualDeviceConfigSpec[]. It should be a VirtualDevice[].

Fix tests which depended on the wrong type.

Add _create_array_of_type function to fake to create an array type
which works correctly when passed to code. A returned array of Foo
must be an instance of class ArrayOfFoo, and contain a single
property, Foo, which is a python array of objects of type Foo.

Change-Id: Ic90e1d0d947941621606fded9e56f9a98d111cad
VMware: refactor spawn() code to build a new VM

Move the spawn() code which builds a new VM into
vmops.build_virtual_machine().

We remove the duplicate check of instance_name. Other than that this
is straight code motion.

In addition, we add a basic test of the function of
build_virtual_machine, which tests that all given configuration is
reflected in the resulting virtual machine.

This change has been split out of
https://review.openstack.org/#/c/87002/, which was written by Shawn
Hartsock.

partial blueprint vmware-spawn-refactor

Co-authored-by: Shawn Hartsock <hartsocks@acm.org>
Change-Id: Id9c95966eefb644fdaf36465e7b3d3583826314a
VMware: spawn refactor _configure_config_drive

Factor out the code to configure the virtual machine with a new
config drive iso image.

partial blueprint vmware-spawn-refactor
Change-Id: Ie387445ae83e89fc436243a4c8ee9030d5221510
VMware: remove Host class

The class was only used by the ESX driver which was remove in the
commit 1deb31f85a8f5d1e261b2cf1eddc537a5da7f60b.

Change-Id: I026e4c0f463e78e33592c6408d2e688c74a0714b
VMware: remove specific VC support from class VMwareVolumeOps

This support is no longer needed as we only support the VC driver
since commit 1deb31f85a8f5d1e261b2cf1eddc537a5da7f60b.

Change-Id: Iad71fceb580620b1843ce3cf5d926343d8113945
Stop augmenting oslo-incubators default log levels

Thanks to I255a68fc60963386e8fefe65c3ffd269795adbf4, the two modules we
explicitly set log levels for are now in oslo-incubator, so we don't
need the extra code introduced  in
Ib5164a22c5cbfa4f9d881b97bb1f623cd4d2f3f3

Change-Id: Iec7bd35da36135fcaf63a384fa35f849a1319738
Move _is_mapping to more central location

The logic to identify volumes is currently a nested function
in _default_block_device_names, named _is_mapping. It should
be moved to a more general location so others could utilize it
and allow it to be properly unit tested. The following patch
moves _is_mapping to nova/virt/block_device.py and renames it
to is_block_device_mapping.

Change-Id: I560abc4b57ca5bd195282af7cd1ab9bbf7600b67
Closes-Bug: #1351810
Image caching tests: use list comprehension

Use a list comprehension for creating a list of instance objects
for the tests.

Change-Id: If25d024eeeb1503d7a7dc2dbc895b2bf3152c7db