Remove local variable only used in logging.

Kill off the locals() call as well. Just directly calculate the value.

Change-Id: I6b96d08a16feb125d1eb9162ca186bf37b429cd6
Kill off usage of locals() in the filter_scheduler.

We decided we don't like this syntax, so I figured I'd clean up this
file while I was playing with it.

Change-Id: I861b9bfcb98782a2f0b46ac5bff09664a13d339c
Small whitespace tweak.

A small indentation cleanup to the filter scheduler.

Change-Id: I0dc747e483c46f7e3988f813d52f689510dd481f
Add delete_net_interface function

This commit adds a new function that deletes a specific
tap device. This bug fix is targeted for Havana.

Change-Id: I26be5d94550db35358caae642fb9000953346826
fixes: bug #1138408
Add the availability_zone to the volume.usage notifications

The volume.usage notifications are used to enable traffic based billing
on volumes. The availability_zone of the instance is an important piece of
information that can enable more specialized billing of customers.

This makes the volume.usage events consistent with the volume.create.start/end
snapshot.create.start/end, etc. emitted from cinder, which contain the
availability_zone field.

Change-Id: I9b6b03174cd03235d0e6cf01e34a6da13bd9bb70
Merge "Remove local variable only used in logging."
Fix building quantumapi network model with network list

Bug 1171636 occurs when _build_network_info_model() receives a list
of networks that does not fully map all of an instance's ports.
It crashes in _ensure_requested_network_ordering() when the list of
all ports is sorted by the subset of networks provided.

This change simplifies the early part of that function to only
consider ports within the networks provided, and to always sort those
ports in network order. This allows us to remove some error path
code from the loop below that iterates over the ports (which contained
a fatal typo, by the way) which is now dead code.

The affected code is really untested at the moment, due to the
structure of the method, making it hard to add a unit test to cover
this fix. In order to make the change clear from the existing code,
this fix is provided here first, and the following patch restructures
the method and add tests for this change and the rest of the surrounding
code.

Fixes bug 1171636

Change-Id: Idf519a88415844451b18959b38cc48ce92c090d1
Make _build_network_info_model testable

This restructures the quantumapi _build_network_info_model()
method to be testable and adds tests for each of the smaller
components. It also provides verification for bug 1171636 by
ensuring that ports returned from the client that are not in the
set of networks passed don't cause the failure detailed in that
bug.

Change-Id: I82f20f68122fc38e72c31e52283529614252c174
Merge "Kill off usage of locals() in the filter_scheduler."
Merge "Small whitespace tweak."
Fix attach when running as root without sysfsutils

When someone runs nova as root, and sysfsutils is not installed
an exception was being thrown when a volume attach call was made.
This wouldn't happen when being run as non-root because of the
rootwrap would trap for the missing sysfsutils app (systool).

Change-Id: Icc852fa7fd7a137cc7df86b8b96aeb629639ffad
Fixes: bug 1172486
Merge "Add the availability_zone to the volume.usage notifications"
Fix baremetal get_available_nodes

Baremetal driver get_available_nodes was incorrectly returning only a
list of unprovisioned nodes, leading update_availabile_resources to
sometimes delete a baremetal node that had an instance provisioned
to it -- sometimes even while the provisioning was still in process.

Fix bug 1174952

Change-Id: I4f08a2f6539a5b6cd12245ac6b4dc308767ae0cd
Merge "Fix attach when running as root without sysfsutils"
import and install gettext in vm_vdi_cleaner.py

importing some nova modules expects _() to be defined, so lets define it
before we start importing them.

Change-Id: I7f951a24c19a53434c090cd2c01eded77c703943
Import oslo periodic tasks support.

I'll move nova across to this in the next review, I just want to
make the import clearly separate.

Change-Id: I4eefd9c73d443afcd0697ff5ddd59abf315b10e5
Update to using oslo periodic tasks implementation.

Convert nova to using the oslo periodic tasks implementation. There
are no functional changes in this review.

Change-Id: I767e0ad17781d5f9d5e987e0a4ad65796243ae5c
Catch glance image create exceptions

Catch exception from glance when image creation fails because the
requested name is too long. Currently the exception is not caught
in the api which results in an 400 Bad Request correctly being
returned, but also leaving a traceback in the logs. Correctly catching
the exception and explicitly raising an HTTPBadRequest removes
the production of the traceback.

Fixes bug #1169560

Change-Id: I511da79cb0b1b4578bf43f0819b2ac64fb6e5fb3
Convert the cache key from unicode to a string.

The memcached API expects string format, not unicode.
Convert the key passed to the memory cache to a string
before sending it to memcached. Since both the function
name and the id that form the key are ascii format, a
simple conversion from unicode to str is sufficient.

Change-Id: I9d15858ad4e10aa183444cccda9c33676059e55a
Fixes: bug #1174487
Rename _check_image_size to _get_and_check_image_metadata

This method has functionality which doesn't seem to match what
it actually does (which is getting image metadata and performing
basic checks on that data).

Change-Id: I818fb5079105cca8acbdf464d47a92f7b1ebb398