Fixes messages logged on Glance plugin retries

Retry logic is now being used for both upload_vhd and download_vhd,
but nova/virt/xenapi/client/session.py still had 'upload_vhd'
hardcoded in its logged messages. This change causes it to accept the
function being used as an argument and display that.

Fixes-Bug: #1265054
Change-Id: I6203aef81960078f92fa7839e47ee1c84df95745
Add return value to some network API methods

Add return value to api methods add_fixed_ip_to_instance() and
remove_fixed_ip_from_instance(). This allows the @refresh_cache
decorator to use returned nw_info model for updating instance
info cache instead of needing to make another rpc call to get
that same information.

Tests are added to make sure return values are used by the
refresh_cache decorator for methods where the rpc call returns
with the necessary nw_info model.

Change-Id: I748e4db9de62d82e4dbcb0b9c444b16dabf0ec5d
Partial-Bug: #1284345
Sync oslo imageutils, strutils to Nova

Changes in imageutils:
===============================
b455fac Enable decimal value input in imageutils.QemuImgInfo
bec3a5e Implements SI/IEC unit system conversion to bytes
8b2b0b7 Use hacking import_exceptions for gettextutils._
aad179d Fixing misspelled encryption key in QemuImgInfo
12bcdb7 Remove vim header
2bd46eb Refactors byte size extraction logic

Changes in strutils:
====================
bec3a5e Implements SI/IEC unit system conversion to bytes
e53fe85 strutils bool_from_string, allow specified default
8b2b0b7 Use hacking import_exceptions for gettextutils._
84d461e Fix a bug in safe_encode where it returns a bytes object in py3
12bcdb7 Remove vim header
3970d46 Fix typos in oslo
1a2df89 Enable H302 hacking check
67bd769 python3: Fix traceback while running python3.
b0c51ec Refactors to_bytes

Change-Id: I3e887756af37823dc6486d1496222825ddc20f0c
Related-bug: #1189635
Related-bug: #1193765
Related-Bug: #1257829
Catch InstanceInLocked exception for rescue and instance metadata APIs

When VM is locked by nova, VM API should not execute.
There are so many api that cannot be executed when vm is locked.
rescue/unrescue
update_instance_metadata/delete_instance_metadata
the above APIs should be updated to catch InstanceIsLocked exception

Change-Id: Ic88f3d190894d4b65f54b34660efd9ae83fb0ee4
Closes-Bug: #1266960
Fix description of ServerGroupAffinityFilter

ServerGroupAffinityFilter was used instead of
ServerGroupAntiAffinityFilter in the filter description.

Change-Id: I16721db5a7dcf90e72047dd5ca5a4f55088c147d
Make example 'entry_points' parameter a dictionary

Change-Id: Idad5a1b2d6aaee456cdc3a52554c1d7ddd51a696
Reduce config access in scheduler

Caching the configuration appears to make a impact on the time spent
in the scheduler. These config values reduce the time spent down from
around 5ms to around 4ms per request, when with 200 hosts.

Change-Id: I433cbbdbef4ac3c01a3e2b6ed5cf092a5cce6372
Add tests for remaining expected conductor exceptions

This fills out coverage of our expected exceptions on conductor
methods, which helps ensure we don't drop an expected exception
class during a refactor.

Change-Id: Iacd5315d47ad97c8aad43d2f6a23674529775e63
Refactor Network API

Base network API class to have all the methods that can be implemented
by specific network api's.

 * Move common logic and decorators to network/base_api.py
 * Base class base_api.NetworkAPI with current methods from
   nova & neutron, that will raise NotImplementedError()
 * Refactor some tests with mock

When this get merged, every review adding new methods to neutron or
nova network, must have the same methods added to the base NetworkAPI.

Implements: bp refactor-network-api

Change-Id: Ia507e80dfd1e0b7552c5d50e84ac9e642ca8c9fe
Fix anti-affinity server-group boot failure

When the second instance is booted to an anti-affinity group
the scheduler fails with an exception due to a missing type conversion.

Closes-Bug: #1301982
Change-Id: I87b2a8d8c7d04b781c789374d6e9c7f4c8567e5d
Revert "Use debug level logging during unit tests"

This change made the subunit_log 190 MB on every run (14MB
in the gz version). It also dramatically increases the
memory needed to run unit tests. We need to revert and
come at this problem with fresh eyes to address the problem
at hand without effectively overrunning people's environments.

This reverts commit f9090b0bd796f8c2fdf8d0a23173f3adee71b3df.

Change-Id: Ia1cfc3d874ddf4f8ee2037b487d22f968585854e
Enable ServerGroup scheduler filters by default

The Icehouse release includes a server group REST API. For these
groups to actually function properly, the server group scheduler
filters must be enabled. So, these filters should be enabled by
default since the API is also enabled by default. If the API is not
used, the scheduler filters will be a no-op.

DocImpact
Change-Id: Ia52d7fcfff52377d8beae2acd9b7eba9c6c74e09
Closes-bug: #1303983
Update docs to reflect new default filters

Server group scheduler filters were added to the default set of
scheduler filters.  Update the docs to reflect the updated defaults.

Change-Id: I614cf83e419c93038fc4ed7287ec743cedb4860e
Related-bug: #1303983
Updated from global requirements

Change-Id: I580d7706618c05ef24e1cae0bb0f887968aca26c
Correct test boundary for libvirt_driver.get_info

The test_get_domain_info_with_more_return() unit test was causing
failure on some systems where lxml was not capable of handling None for
the xml to parse. However, our unit tests should not be testing libvirt;
the unit tests in libvirt already do that. Our unit tests should simply
test the code boundaries of the unit of code that they wish to stress,
and not anything further.

This patch changes the unit test in question to only test the code
within the libvirt_driver.LibvirtDriver.get_info() method, and nothing
more, and in doing so, we remove any calls at all to libvirt and mock
out where the code passes the boundaries of the get_info() method.

Change-Id: I022cc331a980c2a4d98f16d2d77b24839b528464
Closes-bug: #1301602
Merge "Reduce config access in scheduler"
Adds missing expected_errors for V3 API multinic extension

The V3 API multinic extension is missing the expected errors
decorators which means that unexpected internal Nova exceptions
are not caught correctly. This patch adds the expected error
decorators.

Change-Id: I99311275197bb5123079c8910855386252028dec
Closes-Bug: 1303781
Recover from POWERING-* state on compute manager start-up

If a compute manager is stopped / fails during POWERING-ON or
POWERING-OFF operations then the instance will be left stuck in
a transitional task_state.

This change handles both these states by simply either retriggering
the power on or power off request on start-up of the compute manager.
If the operation had previously completed then retrying will
essentially be a no-op so it is safe to handle instances in this
state in this way.

Closes bug: #1304333
Change-Id: I262be6b13a764bc1355be34cdc0180e8e87f260b
Merge "Revert "Use debug level logging during unit tests""
Merge "Fix description of ServerGroupAffinityFilter"