libvirt: Avoid Glance.show on hard_reboot

When a Libvirt host is rebooted, we can optionally choose to automatically
spin back up the instances using the `resume_state_on_host_boot` call. This,
in turn, uses `_hard_reboot` to bring back the instances.

The problem is that `_get_guest_xml` which `_hard_reboot` is using is always
making a call to Glance.show since `image_meta` isn't being passed into it. In
addition to this being an extra latency-heavy call, this is big problem
because the request is *server-generated* not *user-generated* so we won't
have the necessary user-request context to make the Glance call.

In the absense of a general user-impersonation mechanism, the current
workaround is to use cached image-metadata, which works in this case as well.

So the fix is to pass that `image_meta` that we already pull from instance
metadata in `_hard_reboot` and pass it into `_get_guest_xml` and thus avoid
the extra request to Glance.

Change-Id: I2203ac709405ee784ee5ec017aa475575a46a0df
Closes-Bug: 1339386
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
Remove warn log for over quota

Over quota exception is already raised at API layer
and no need to print a warning log.

Change-Id: If44d5f2dd0e11d15d57cf6ab247f5e9e7fe75a9c
Rename virtutils to the more common libvirt_utils

`libvirt_utils` is the more prevalent alias in the code for the module, so
rename `virtutils` to match.

Change-Id: Ib8d4291866bc53fa1980b70dd0f12e6b1fe10436
Turn periodic tasks off in all unit tests

We shouldn't rely on periodic tasks to randomly run in unit tests,
instead if we need them to run we should explicitly call them out.

Change-Id: I35850c47288e50d3146771dc7a9a54d62e36c3cf
Related-Bug: 1311778
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
Revert "Add extensible resources to resource tracker"

This bug added a regression to both nova-bm and ironic,
neither can deploy instances.
Fixes-bug: #1347795

This reverts commit 50b4ba4ee583d25eef10a6608172c002f9bec6f2.

Change-Id: Icc8d629467911972480b633c7808a0964c9f1c7d
Add i18n log markers in disk api

    Improve LOG i18n log markers in nova/virt/disk/api.py.

Change-Id: I76b5a2acc15bd4230ea6e243770ac0590c56235d
Make the coding style consistent with other Controller in plugins/v3

Add ALIAS and authorize as a global variable.

Change-Id: I6bc995008206d033ac4ac1e81c6954e999262861
Augment oslo's default log levels with nova specific ones.

Thanks to I49a82c5b3446784d254ca558f51b6c3e5c2028eb, we can augment
oslo's set of default log levels with project specific ones.

Add keystonemiddleware as warn level since its verbose and nova isn't
trying to debug keystonemiddleware.

Add routes.middleware since this generates 3 log entries per API request
and doesn't help make debugging easier.

Change-Id: Ib5164a22c5cbfa4f9d881b97bb1f623cd4d2f3f3
reduce network down time during live-migration

Called unplug_vifs() method before post_live_migration_to_destination call
because floating ip address will not work until the vifs are unplugged
from the source compute node.

Added new method post_live_migration_at_source in virt driver and
implemented it in libvirt driver to unplug the vifs at source. Other
drivers will raise NotImplementedError.
Added new keyword argument destroy_vifs to cleanup() method to verify
if unplug_vifs() is already called then do not call it again.

Closes-Bug: #1284996
Change-Id: Ida3ed3bef77239e5a0fdbf8866e8a4421d4f8222
Add Hyper-V driver in the "compute_driver" option description

The description of the option "compute_driver" should include
hyperv.HyperVDriver along with the other supported driver.

Change-Id: Ic7e16fd5154609987b2ef0b6f8ee52619ccf489c
Closes-bug: #1347777
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
Fix FloatingIP.save() passing FixedIP object to sqlalchemy

This prevents the FloatingIP.save() method from passing the
calculated FixedIP object to the sqlalchemy floating_ip_update()
function, which would expect it to be an SA object. It also
aborts any attempt to save the object with a modified fixed_ip_id
linkage, as associate/disassociate should be used for that.

This also fixes a bug where FloatingIP expects the result of
floating_ip_update() to be a FloatingIp SA object.

Change-Id: I065caedf4d81c8583a3b390934a1d403cf2e87bd
Closes-bug: #1334164
Fix the i18n for some warnings in compute utils

Change-Id: I82a5602bdbecb931c046bb693f16917f38a075fb
Merge "reduce network down time during live-migration"
Merge "libvirt: Avoid Glance.show on hard_reboot"
Merge "Revert "Add extensible resources to resource tracker""
Merge "Turn periodic tasks off in all unit tests"
Merge "Fix the i18n for some warnings in compute utils"