Restore instance flavor info when driver finish_migration fails

when instance resize, it will call finish_migration at last to create
new instance and destroy old instance. If driver layer has problem in
create new instance, the instance will be set to 'ERROR' state.

we are able to use reset-state --active to reset the instance and use it
but the instance information is set to new flavor
and not reverted to old one

Change-Id: I5961260f50e7893c7bf03e329e06edfd4f295640
Closes-Bug: #1296519
libvirt: add support for per-vCPU pinning in guest XML

Expand LibvirtConfigGuestCPUTune to allow setting of a
cpu mask per-vCPU

Blueprint: virt-driver-cpu-pinning
Change-Id: I547be6c7da4e3ebc9759f8310cb6282ac4b2f50c
libvirt: add support for memory backing parameters

Add a libvirt config class for dealing with the XML elements
under the <memoryBacking> section of the guest schema.

Blueprint: virt-driver-large-pages
Change-Id: Icd89508671a8951bed480b901b2d12d44ebb7cab
vmwareapi: remove some unused fake vim methods

Rename_Task unused since I92acdd5cd00f739d504738413d3b63a2e17f2866

AcquireCloneTicket and PowerDownHostToStandBy_Task were never used.

Change-Id: I025d121db41ed1f6084364ff1a52eade1c3d6a90
Log translation hint for nova.api

Currently, Log translation is motivated by oslo's move to prioritized
translation of strings, as documented at
https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation

- add log translation hints for warning, error and info levels
- move from LOG.warning to LOG.warn
- remove use of % as a string formatter, use the log functionality
  instead

Change-Id: I128da6cbb2be1b5b51b4a79fb38b3bf8206431d9
libvirt: remove VIF driver classes deprecated in Icehouse

In Icehouse the old VIF driver classes were set as deprecated
to be removed in Juno. Now they can be finally deleted.

Related-bug: #1302796
Change-Id: I7be735062e6cc6aa54dec1bf43d3cce1ac544988
Pass errors from detach methods back to api proc

The initial implementation of the detach_interface method was built as
cast invocations.  The respective attach method was built as a call
invocation.  What this led to was, if the user attempted to attach an
incorrect port, that error would be passed back up to the API
properly.

However, if the user attempted to detach an invalid interface, the
response from the API would be an HTTP 202 (because the cast assumes
success).  The root error may be logged in the respective nova compute
log, but it did not make its way back up to the user.

This change updates the decorators to the manager methods to update
the instance's fault when the attach or detach encounters an issue.

Change-Id: I111b1c8a492f12587f86ab83825060029605390d
Closes-Bug: #1339098
Do not pass instances without host to compute API

Even if the server external events extension filters out events
whose related instance does not have a host, the corresponding
instance is still sent to the compute API module.
As this might result in KeyError, instance without host should
be filtered out before calling the compute API module.

Change-Id: If5229ec3059076dbc9f4abb6625504e8864c265e
Closes-Bug: #1348584
Merge "Log translation hint for nova.api"
virt: force TCG with libguestfs unless KVM is enabled in libvirt

If the libvirt driver has not been configured to use KVM, then
the libguestfs module should be forced to use TCG. This is
particularly important when running Nova inside a VM, which
might claim to have VMX/SVM support when it is in fact broken.
This will avoid libguestfs hanging in such scenarios.

Resolves-bug: #1286256
Change-Id: I9316dcedd65244c60d468b270311f032b45b051f
Merge "Restore instance flavor info when driver finish_migration fails"
Merge "libvirt: add support for per-vCPU pinning in guest XML"
Stub out rpc notifications in ec2 cloud unit tests

The ec2 cloud unit tests are running through the compute
manager and if something fails and is wrapped with the
wrap_exception decorator, we can get big ugly stack traces
in the log. We should be using the fake_notifier in these
tests like we do in the nova.tests.compute.test_compute
setup.

This also changes the test_ec2_validate test to use
local conductor like the other cloud tests that are going
through conductor.

Change-Id: I59bed0903aeef4086872c10d93a06f34b072dce3
Partial-Bug: #1348661
Make several ec2 API tests inherit from NoDBTestCase

There are several ec2 API test classes which aren't
using the database so we should have them inherit from
the NoDBTestCase base class.

Change-Id: I6c2fcca72c93d6528a40813652c0bb6d6783ee09
Merge "libvirt: add support for memory backing parameters"
Fix doc build errors in models.py

The docs build has errors like the following:
nova/nova/db/sqlalchemy/models.py:docstring of
nova.db.sqlalchemy.models.relationship:517: ERROR: Unknown interpreted
text role "paramref".

To fix this remove the import for relationship and refer to it
instead using orm.relationship.

Change-Id: I2e0a08438174f0fe0d7ea732670971e65811a700
libvirt: driver tests use non-mocked BDMs

Ia99e04ad80a2823a6852debf0919e72b2f93bd26 introduces tests that
completely mock out the nova.virt.DriverBlockDevice classes. While this
is generally OK - it is more desirable to test the code with only
the furthest bits from the object/method under test mocked.

It was not practical to do it at the time due to __setattr__ behaviour
which is now changed - so let's fix this too.

Change-Id: I186e9c07aafb18b3d9010c5794bb7964f1ff0056
Merge "virt: force TCG with libguestfs unless KVM is enabled in libvirt"
Merge "vmwareapi: remove some unused fake vim methods"
Merge "Do not pass instances without host to compute API"