Fix error status code for multinic

When passing bad body in a request, most APIs return BadRequest response.
However, multinic API doesn't do it.
This patch fixes the error status code and adds a unit test related to
this change.

This patch's idea most came from
following patch: https://review.openstack.org/#/c/107266/

Change-Id: If1ef2077a0e9823dfc04e4ef5a6dfb02daf1a8dc
Restore ability to delete aggregate metadata

Commit I2c778f2237ba5bd2aa8335a0eae80f3aad3e9157 tightened the
input validation for setting the metadata for an
aggregate. However it also accidentally excluded sending
null as the metadata value which has previously allowed the
deletion of the metadata key rather than an update. This
changeset relaxes the input validation to allow deletion of
aggregate metadata again

Change-Id: I54b91c2d421243e7e7521f2352598f73a258b88a
Closes-Bug: 1334846
Add decorator expected_errors to V3 servers core

All v3 api should use expected_errors to prevent unexpected exception
raised. This patch add decorator expected_errors for v3 servers core.

Change-Id: Ia1fa09d6cf68a65c85ac5fd2aff9b9202d76e7ca
Closes-Bug: #1343778
Remove unnecessary error log in cell API

There are unnnecessary error logs in cell API. It tried to log
error for invalid input which is not necessary because we already
raises exception for the bad request.
This patch removes them in both v2/v3 API.

Change-Id: Idd239903aa830f5d8fe50336dfa63a43b617584f
Keep resizing&resized instances when compute init

During compute manager startup init_host is called. One of the
functions there is to delete instance data that doesn't belong
to this host i.e. _destroy_evacuated_instances.
But this function only checks if the local instance belongs to
the host or not. It doesn't check the task_state or vm_state.

In Resize function, user may want to revert or confirm the resize
operations so the instance on source and dest compute node should
be kept. so for RESIZE_MIGRATING, RESIZE_MIGRATED task states and
RESIZED vm state instances, they should be kept in compute node
when the compute restart. This patch adds check for the task
state and vm state before delete the instances.

Closes-Bug: #1330503

Change-Id: I723fa4a8823019391ea83aa189096531032adab1
Catch CannotResizeDisk exception when resize to zero disk

When old flavor's root_gb is not equal 0 and new flavor's root_gb is 0,
the resize() in nova.compute.api will raise CannotResizeDisk.

Move up the new_instance_type check before using.

Closes-Bug: #1340159

Change-Id: I4abf93530cf919af50a88d6049019fb745547257
VMware: improve log message for attachment of CDROM

Commit 3c59d998c5e6b80549053b01f919ac318cd31b13 config drive
support. The log message makes use of the instance_name which is
not unique. The may be confusing when debugging.

TrivialFix

Change-Id: Iff7f4f938f4980f0c0bf2dc3017ed741453a69f5
libvirt: removing lxc specific disk mapping

Currently, LXC specific disk mapping is being created, preventing
the attached volumes from being added to the LXC disk mapping.
Removing this part, to allow volumes to be included in mapping.

Related-Bug: #1269990
Change-Id: I97bcff558b6d8876a10adb36c19ab3f4c972a708
Stop depending on sitepackages libvirt-python

We can install libvirt-python bindings from pypi now because the libvirt
devs are supporting pypi packages and the version of libvirt we are
testing nova master against is new enough to link against that pypi
package.

Making this switch will better isolate nova test environments as all
dependencies can be installed without any site packages leaking into
virtualenvs. It will also make the dependency on libvirt-python a bit
more explicit.

Change-Id: I2890702869f05a02ad5e2ecb419db06433231b36
Move libvirt RBD utilities to a new file

This will make it easier to share rbd-related code with cinder and glance.
Port the applicable unit tests over from cinder.

Closes-Bug: #1346092
Co-Authored-By: Dmitry Borodaenko <dborodaenko@mirantis.com>
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Signed-off-by: Dmitry Borodaenko <dborodaenko@mirantis.com>
Change-Id: I614b8e2bf0ea9e71a73772cbabcf812b39fa8a34
Use library instead of CLI to cleanup RBD volumes

'rbd list' CLI returns error code when there are no rbd volumes, which
causes problems during live migration of VMs with RBD backed ephemeral
volumes. It's safer to use the library that only raises an exception in
case of a real problem.

The only case where rbd CLI is still justified is import, which is
needed to correctly import sparse image files.

All code related to cleanup of RBD volumes is moved to rbd.py, this
fixes a yo-yo problem with single-use methods scattered across 3
different files, and minimizes impact of this fix on imports in
imagebackend and utils.

Closes-Bug: #1346092
Change-Id: I92cd6b16fbd93b377fe47b15d22efbbf68d02513
Signed-off-by: Dmitry Borodaenko <dborodaenko@mirantis.com>
Merge "Move libvirt RBD utilities to a new file"
Merge "Keep resizing&resized instances when compute init"
Merge "Catch CannotResizeDisk exception when resize to zero disk"
Merge "Fix error status code for multinic"
Merge "Remove unnecessary error log in cell API"
Merge "Add decorator expected_errors to V3 servers core"
Merge "Restore ability to delete aggregate metadata"
Merge "libvirt: removing lxc specific disk mapping"
Merge "Use library instead of CLI to cleanup RBD volumes"