Only load necessary instance info for use in sync power state

During sync power state, instance is refreshed from the db. If the
instance gets deleted, this can result in InstanceInfoCacheNotFound
being thrown due to info_cache being loaded and therefore refreshed.

Sync power state does not make use of any extra instance attrs, so
this problem can be avoided by not loading any extra attrs in the
first place.

Two callers of _sync_instance_power_state() are updated to not load
extra attrs. 1) The periodic sync and 2) the lifecycle event handler.

Change-Id: I150bd95da65263981608dd9a033232bd142e737f
Closes-Bug: #1367845
Don't modify columns_to_join formal parameter in _manual_join_columns

The _manual_join_columns method was modifying the columns_to_join list
passed to it which, if not copied by the original caller, can introduce
bugs in the calling code if the original columns_to_join list is re-used
later, e.g. making nova objects with an expected_attrs list that has
been mutated by the DB API call.

This change makes a copy of the original list and passes back the new
list for the DB API methods to use, and adds some documentation to
hopefully clarify intent and usage.

A test is added to demonstrate the expected behavior of the utility
method.

Closes-Bug: #1393491

Change-Id: I49511f608291b66642ced00a3c13833e18fab3d7
Set vm state error when raising unexpected exception in live migrate

The instance stuck at migrating task_state when unexpected exception.
This is confuse for user, this patch set the vm_state to error.

Change-Id: Ib1b97452bc5e777c66c4d368f71156dbe1e116b7
Partial-Bug: 1397153
Compute: Catch binding failed exception while init host

While compute starts it will init all instances,
if an exception is raised from one instance
(e.g NovaException during plug_vifs), then the
compute process exits unexpectedly because of
this unhandled exception.
This commit changes the NovaException to more
appropriate VirtualInterfacePlugException and
catches it during init host, as well as the
instance is set to error state, with this change
the compute process can be started normally even
if this VirtualInterfacePlugException is raised.

Closes-bug: #1324041

Change-Id: Ia584dba66affb86787e3069df19bd17b89cb5c49
Share server access ips tests between V2 & V2.1

As server access ips should behave same in V2 and V2.1,
access ips tests can be shared among V2 & V2.1 to cleanup
duplicated test code.

This patch share those tests between V2 & V2.1

Partially implements blueprint v2-on-v3-api

Change-Id: Ife0b3f35ec6bd0d3c0052d2a8c0f314638a07ca3
Check for floating IP pool in nova-network

There are no checks in nova-network to see if a specified
floating IP pool exists or not before attempting to allocate
an IP address. If a pool does not exist, nova throws an
unrelated error - 'No more floating ips available'. The
following patch adds a check for the existence of the IP pool
and throws a FloatingIpPoolNotFound if it is not found.

Change-Id: I72cb8dd044f7ac094287bad7df9167b8e77a4b5b
Related-Bug: #1355623
Adds hacking check for api_version decorator

Because of the implementation of this decorator and the controller's metaclass,
the api_version decorator must be the outermost (ie first) decorator wherever
it is used. This patch adds a hacking check to ensure that this is the case.

This decorator is intended to be used on multiple methods with the same name
which offends F811, so '#noqa' is needed too. This will be fixed in a separate
patch.

Bad:
    @some_decorator # noqa  <-- '# noqa' to avoid F811
    @api_version("2.5")     <-- Error, needs to be the first decorator
    def my_api_method...

Good:
    @api_version("2.5") # noqa   <-- this line still needs '# noqa' for F811
    @some_decorator
    def my_api_method...

Change-Id: I579c0061f03d788c477c5424d4d00ec7a6e721e1
Remove unused db.api.fixed_ip_get_by_address_detailed

Change-Id: I23ccad0460f38db5314180fda865153bd8784c01
libvirt: Fixes live migration for volume backed instances

Live migration fails for volume backed instances in LibvirtDriver
because _is_shared_block_storage() incorrectly identifies volume
backed disks as local. This is fixed by passing the block_device_info
parameter to get_instance_disk_info, which allows for correct
filtering of volume backed disks.

Change-Id: I1437b2a7d5a62615b0099114ed1b5b1110f56de2
Closes-bug: 1392773
Modify v21 alias name for compatible with v2

This patch changes some of the alias names to be compatible with v2.
so the extension info output will be as same with v2.
 consoles -> os-consoles
 flavor-extra-specs -> os-flavor-extra-specs
 flavor-manage -> os-flavor-manage

Partially implements blueprint v2-on-v3-api

Change-Id: Ia8c6a0144e43134667636db9ba862b26f265a433
VMware: remove flag in tests indicating VC is supported

The ESX driver is no longer supported so this code is no longer
needed.

Change-Id: I03d2ea7935040b656c4a32de219d018f0ab89161
Doc: minor fixes to unit testing devref

The unit testing devref had a bit of inconsistent formatting, and a reference
to HACKING.rst which could have been linkifed.  This patch fixes both of those,
and additionally the examples have been updated to reflect the recent split
into functional and unit tests.

Change-Id: I15129808d0d1271c1223e7ab8d8532f8cb2f7293
extract fixtures from nova.test to nova.test.fixtures

Start extracting all the setup code in note.test into fixtures which
will let us decompose test setup (and have test base classes that
don't setup everything).

This creates new OutputStreamCapture fixture and StandardLogging
fixture and unit tests for both of them plus tests for the exiting
Conf fixture.

H305/306 have to be turned off because hacking import rules are broken
and continue to believe that fixtures is a nova module not the
absolute one.

Change-Id: I97fdacdf5a6ad2957b0efa1e21ae084d4eb04ab9
move ServiceFixture and TranslationFixture

Move these into the new namespace. No additional testing added at this
point.

Change-Id: I0a45dab39745591a55ffc91b31aed8df5179767a
move all conf overrides to conf_fixture

Some config overrides were in conf_fixture, and some were living in
test.py:setUp. If we are globally overriding conf variables we should
do it in one place, the fixture.

Change-Id: Ief66e2245179a37eae60bafaf9e8f452d89319a7
Clarify point of setting dirname in load_standard_extensions

Changing dirname to alter how os.walk visits directories is a little
known feature, so add a note inline explaining how it works.

This came up because someone filed a bug saying this block of code was
confusing.

Closes-Bug: #1399546
Change-Id: I4cab323fcc7a4e2aab2ca7c36d6b9505b6a05bcb
Merge "Doc: minor fixes to unit testing devref"
Merge "Adds hacking check for api_version decorator"
Merge "Clarify point of setting dirname in load_standard_extensions"
Merge "extract fixtures from nova.test to nova.test.fixtures"