Support cinderclient http retries.

HTTP retries were recently added to cinderclient. This adds the
config option required to use it. The default (unchanged) behavior
is 0 retries.

Change-Id: Ia7ad831045e8df9ad9c22f0119ae3485d91ad949
Conductor instance_get_all replaces _by_filters

Updates the Nova conductor so that it uses instance_get_all()
and instance_get_all_by_host() from the Nova DB API to
implement its own like named functions.

This fixes a regression that occured in d22b0ca where we switched
from using the DB API's instance_get_all_by_host and instance_get_all
methods over to the DB APIs instance_get_all_by_filters.

This caused some subtle regressions due to the fact that
instance_get_all_by_filters has different defaults for
deleted records.

The previously used (prior to d22b0ca) instance_get_all() and
instance_get_all_by_host() functions rely on the context.read_deleted
and also handle the display of deleted and soft deleted records differently.

Fixes LP Bug #1096972.

Change-Id: Icb587ef169d1d7dd86cf6ee682e74bd4e84c37e2
Add exception handler for previous deleted flavor.

An exception happens if a previous flavor is deleted and
'nova resize-revert' run, because 'nova resize-revert' does
not handle the deleted flavor.
And also we have the same problem in _update_usage_from_migration().
This patch fixes the problems.

How to reproduce the problem on DevStack:
  $ nova flavor-create sample 10 512 0 2
  $ nova boot --image cirros-0.3.0-x86_64-uec --flavor sample test01
  $ nova resize test01 m1.tiny
  $ nova flavor-delete 10
  $ nova resize-revert test01

Before applying this patch:
  $ nova resize-revert test01
  ERROR: The server could not comply with the request since it is
  either malformed or otherwise incorrect. (HTTP 400) (Request-ID:
  req-b0d3e016-9608-4a87-a0cc-44dfe00b25a1)
  $

After applying this patch:
  $ nova resize-revert test01
  ERROR: Flavor used by the instance could not be found. (HTTP 400)
  (Request-ID: req-ed4ce174-33f2-4258-b522-674a1023ea74)
  $

Fixes bug 1091490

Change-Id: I39dd23a7565ae66544e8bc2aa7ad3299eb61bfcc
powervm: Implement snapshot for local volumes

Snapshot local volumes by copying the logical volume on VIOS,
gzip the file, transfer to compute service node, and
finally upload to glance. PEP8 and string concatenation fixes.
Added utility to powervm.common for constructing UNIX file paths.
Added unit tests for new utility.

bp powervm-compute-enhancements

Change-Id: Ie6bafbeef75a9464457d78d2997be78346d3ab24
Add api extension to get and reset password

Password is stored in system_instance_metadata as four items with the
keys 'password_0' through 'password_3'. The extension adds a resource
endpoint with two methods:

GET v2/servers/<uuid>/os-server-password  # get_password
DELETE v2/servers/<uuid>/os-server-password # reset_password

get_password retuns:

JSON: {"password": "xxx"}
XML: <?xml version='1.0' encoding='UTF-8'?><password>xxx</password>

Note that this is intended to be an encrypted password set by the
guest. Includes api tests for json and xml. Also includes api samples.

Part of blueprint get-password

Change-Id: I6c03f9c3bc8a2c70403bbb3e57917ab9522d75bd
fix N401 errors, stop ignoring all N4* errors

We had previously been ignoring all our custom N4xx hacking.py
errors. This fixes all the N401 errors "doc strings
should not start with a space" and reduces the ignore set down
to N402 only "single line docstrings should end with period".

It also fixes the N401 parser to catch only docstrings, and
not tripple quoted string blocks used later on in a function.

Clean up a few of the more crazy uses of """ in our code

Clean up additional funky comments to make indents a bit more
consistent, and pull in lines when possible.

Change-Id: I9040a1d2ca7efda83bd5e425b95d1408b5b63577
Remove unused osapi_path option

This has been unused since deprecated auth was removed. It looks like
we intended to remove this in commit ea06eff7.

Change-Id: I7a5868c42300ba92d5c8f528a447cfe3fbace297
CLI for bare-metal database sync.

Part 3 of 6: blueprint general-bare-metal-provisioning-framework.

Change-Id: Ia19ce00edb84aa924c2ab2c9c2217f6b49073d69
Co-authored-by: Mikyung Kang <mkkang@isi.edu>
Co-authored-by: David Kang <dkang@isi.edu>
Co-authored-by: Ken Igarashi <igarashik@nttdocomo.co.jp>
Co-authored-by: Arata Notsu <notsu@virtualtech.jp>
Merge "powervm: Implement snapshot for local volumes"
Merge "CLI for bare-metal database sync."
Refresh instance metadata in-place

For some reason that isn't entirely clear to me, the attempt to update
instance metadata in _instance_update() results in a stale sqlalchemy
object state. This is a similar issue to the one fixed in commit:

  9fdf7552779d518af9cda4e366bf81fddb0cb6f2

For some reason, session.refresh() doesn't work for instance['metadata']
in the same way, which also raises suspicion that perhaps it's not the
right fix for system_metadata either.

This patch adds an _instance_update_metadata_in_place() method that
updates the actual instance['metadata'] list _and_ the database,
mirroring the high-level behavior of instance_metadata_update(), but
without requiring us to refresh or re-fetch the metadata or the
whole instance (as a workaround).

Fixes bug 1096653

Change-Id: Ic5a205631b1b7dce3744960ed4201dcc7b4b2ae6
Merge "Conductor instance_get_all replaces _by_filters"
Merge "Support cinderclient http retries."
Merge "Add exception handler for previous deleted flavor."
Merge "Refresh instance metadata in-place"
Merge "Add api extension to get and reset password"
Merge "Remove unused osapi_path option"
Merge "Fix baremetal VIFDriver"
Merge "fix N401 errors, stop ignoring all N4* errors"
Cope better with out of sync bm data.

The baremetal hypervisor tracks references to instances which are
deleted asynchronously from the commit to the nova bm. As such, its a
normal but rare condition for a bare metal node to refer to a deleted
(and even garbage collected) nova instance. We should treat such
instances are deleted rather than erroring on any call through
list_instances(), permitting starting new instances and listing
instances to work - fixing bug: 1096722.

Pathologically, the database may suffer permanent skew, which means we
need a way to fix it (and thats tracked as a separate bug).

Change-Id: Ic21ff66b1fc0ad64bb5feff26291873b96d20e4e