Move volume_clear option to where it's used

The `volume_clear` and `volume_clear_size` option are used in `lvm.py` so we
should move the definition there.

Change-Id: Ic619c2db0bb1b5ccc7dcbec1a500c3dcb1110b26
Correct a maybe-typo in pci_manager

the variable 'dev' in set_hvdevs are only used for list comprehension,
it does not make sense to use 'dev' again for updating self.stale.

Change-Id: I03f31bfcfc56a43e43eb88845e1d562f19a3a09e
baremetal: Remove depenency on libvirt's fetch_image method

It's messy for virt-drivers to depend on each other, so this patch alters
baremetal to use the cross-driver fetch function, instead of the libvirt
version.

Change-Id: I910c621452fa7eb9add417a8738e5757aeb1a48c
libvirt: Fix kwargs for _create_image

Rescue uses the `suffix` and `disk_images` kwargs of `_create_image`, but
passes them in as positional args. We should use explicit kwargs here to be
clear that rescue depends on both of those parameters being present.

In addition, disk mapping was being passed in as kwarg, but is actually a
positional arg, so we should pass it in as a positional arg to be clear that
it's required.

Change-Id: Iaa990729b4bb3569f4c71ceaf1adabed58f73026
Ironic: save DB calls for getting flavor

The commit bceb6342994fc9d38a51a19e5b07652a5fdfd503 would read
the flavor a number of times instead of passing a flavor as a
a parameter.

This save an unnecesary DB access.

Change-Id: I4dc8739129a694d6ddae1ed9f1998663a2204d89
move dict copy in prep for object-ify flavors

This change is to help split up the patches for object-ifying flavors.
It moves a dict copy of instance_type from the tests to
get_flavor_by_flavor_id().

Change-Id: I0082a56aa637169fd6e1db3aad56877c9f745bc5
refactor flavor db fakes in prep for object-ify flavors

This change is to help split up the patches for object-ifying flavors.
It refactors db fakes to provide default values for fields that are
not nullable in flavor objects.

Change-Id: I18575703cd5c52d4f446c9bca1edd7baf33b416f
refactor flavor manage tests in prep for object-ify flavors

This change is to help split up the patches for object-ifying flavors.
It refactors flavor manage tests to provide default values for fields
that are not nullable in flavor objects.

Change-Id: I59f0254269379ace2186ed90810c5d1a9f09fed7
Add developer policy about contractual APIs

Document what APIs nova considers to be public contracts, anything not
in this list should be considered a private API.

Clarify the 'API' section to make sure its clear we are talking about
the REST API.

Change-Id: If71adc7a9d5dc1bde79f75d10e67500f6f92b81f
Enhance  V2 disk_config extension Unit Test

disk_config extension extends the request/response
for server's create, update, rebuild & resize operation.
However, unit tests of the extension are not enough now.

This patch adds more tests to increase code coverage.

Change-Id: Ibdc9a931fac7501a9f8326bae16f3b41d51be9bb
console: introduce a new exception InvalidConnectionInfo

Introduces a new exception InvalidConnectionInfo used when
an effectively connection_info is invalid.
Updates the code to take advantage of this new one.

Change-Id: I21940a14017b8aab5c3ee04c597cb05742a621eb
VMware: remove unnecessary deepcopy

The rescue and unrescue methods had an unnecessay call to deepcopy.
This code was deleted.

TrivialFix

Change-Id: I288ec4620e3d2c16ac17e4664dfb9764c357877e
VMware: remove _get_vim() from VMwareAPISession

This method has side-effects which are not needed and brings only
clutter in the driver. The vim object should be accessed as a standard
property of the session object.
This patch is mostly a mechanical replacement and doesn't change any
existing functionality.

This is part of blueprint use-oslo-vmware

Change-Id: I1e86a2e5afc5c0b5921c0248806f434df0cdef2a
VMWare: Remove unnecessery method

Method get_moref from vim_utils only calls the same method
from oslo.vmware, so remove it and replace usages by
direct usages of oslo.vmware method get_moref

Change-Id: I6b1aadc39c47dd709ae622321ab3110ee7df8803
Mask passwords in exceptions and error messages

When a ProcessExecutionError is thrown by processutils.ssh_execute(),
the exception may contain information such as password. Upstream
applications that just log the message (as several appear to do)
could inadvertently expose these passwords to a user with read access to
the log files. It is therefore considered prudent to invoke
strutils.mask_password() on the command, stdout and stderr in the
exception. A test case has been added (to oslo-incubator) in order to 
ensure that all three are properly masked.

An earlier commit (853d8f9897f8563851441108a9be26b10908c076) failed
to address ssh_execute(). This change set addresses ssh_execute.

OSSA is aware of this change request.

Change-Id: Ie0caf32469126dd9feb44867adf27acb6e383958
Closes-Bug: #1377981
libvirt: convert driver test suite to avoid DB usage

The LibvirtDriverTestCase uses the database for creating
instances and accessing flavors, which can easily be mocked
in the tests. This allows it to be converted to NoDBTestCase
which improves perf from 4.6s to 0.8s

Partial-bug: #1369516
Change-Id: I45e9ae6af3d5c83b54ad1287f2fba44dee30338f
libvirt: convert conn test case to avoid DB usage

The LibvirtConnTestCase uses the database for alot of random
stuff. With a bunch more mocking, it can be converted to use
NoDBTestCase which improves perf from 50s to 9s.

Updates the comment in _get_cpu_numa_config_from_instance to
be explicit about which test cases remain to be converted
after this change.

Closes-bug: #1369516
Change-Id: I1b585cba39913ff4609c6d86dcafc07e6c04e2b8
Correctly catch InstanceExists in servers create API

When osapi_compute_unique_server_name_scope is set to project
or global an attempt to create a server with a name which
already exists results in an InstanceExists exception being raised.
This was not being handled in the API layer causing a 500
status error code. This patch fixes it so the exception is caught
correctly and a 409 Conflict is returned instead

Change-Id: Ifee3476622b227991a4c2a2780ae7ff23787ccb9
Closes-Bug:1376936
Use oslo.utils

oslo.utils library now provides the functionality previously in
oslo-incubator's excutils, importutils, network_utils, strutils
timeutils, units etc. Some modules already moved to oslo.utils
will still be around since other code in nova/openstack/common/
are using it and will be removed in a subsequent commit.

Change-Id: Idc716342535fdfa680963e0e073ddb46f5f1eb34
Port fping extension to work in v2.1/v3 framework

Ports v2 fping extension and adapts it to the v2.1/v3 API
framework. API behaviour is identical.

- unittest code modified to share testing with both v2/v2.1
- Adds expected error decorators for API methods

Partially implements blueprint v2-on-v3-api

Change-Id: I8dc4ede46826bf6062097a3b4ba6be9a09a1bd12