Remove admin auth when getting the list of Neutron API extensions.

Currently _refresh_neutron_extensions_cache() always authenticates
with Neutron using the configured Neutron admin credentials because
it doesn't have access to the calling context.  But it's actually
always called when a valid context exists, and the call to get the
list of extensions is not itself an admin operation.  By passing
the context down we can avoid this additional authentication step.

Change-Id: I9e7d9c5e424a6b39c8f8ee1c79f5fd8f48ad81a2
Closes-Bug: 1250850
Fix cache lock for image not consistent

Currently 2 external (file) locks with different name
are created to protect image concurrent access for libvirt driver.
This may lead to image corruption in rare case. This patch change
the lock file name from nova-_var_lib_nova_instances_base_xxxx
to nova-xxxx to make the lock name consistent

Change-Id: I3e60c3bcf456d2392409aa56ba05f4ad8fdc0444
Closes-Bug: #1265452
Call get_pgsql_connection_info from _test_postgresql_opportunistically

The _test_postgresql_opportunistically method was calling the method to
parse the mysql connection URL which is wrong when there is one
specifically for postgresql, so call the right method.

This wasn't causing issues obviously but is something that needs to be
cleaned up regardless.

Closes-Bug: #1274718

Change-Id: Ic572e612c7ce31d854dc7258aa9c8b89a197260e
Refactoring metadata/base

- Extracted out methods from get_openstack_item for handling version, content and path
- Replaced the if else style route configuration with a route configuration dict
- This will help adding new apis easier and be maintainable

Change-Id: Ie1885c439f3d119032dd1c7c7af070142987ba7f
Partially implements: blueprint metadata-service-callbacks
Prefix private methods with _ in docker driver

Private methods should be prefixed with a _ for
clarity. Although most private methods were
marked this way, a few were not.

Renames and marks private:
 is_daemon_running
 find_container_by_name
 get_available_resource

Closes-Bug: #1267664

Change-Id: Ifc6818b7620af972cc0eec6f9ef43610456895f1
Introduce Guru Meditation Reports into Nova

This commit integrates functionality from the
`openstack.common.report` module into Nova.
This enables Nova services to receive SIGUSR1
and print a Guru Meditation Report to stderr.
The required modules were added to
'openstack-common.conf' as well.

Change-Id: I224a426dad084f0e738069207ffbffe7f7935a17
Implements: blueprint guru-meditation-report
Add pack_action_start/finish helper to InstanceAction object

Add these two helper function to cut InstanceAction object's dependency
on compute/utils.py. This is a refactor change so that
pack_action_start/finish code in compute/utils.py can be removed in a
later change.

The version of InstanceAction object doesn't change, since it's just an
object internal refactoring. No object field or method has been changed.

This is a part of: blueprint make-instance-action-use-objects

Change-Id: I38bde7b057efa0ce5634941f4ffa5ef27123958c
Re-Sync oslo-incubator fixtures

Syncing to add fixture.logging
(I7a4ab4f181634ed5b92ce88e9ed1d976ecb633a7) which will be enabled for
unit tests in a subsequent patch.

Commits Include:
 782fc83 Fixture to reraise exceptions raised during logging
 c178e56 Add basic Python 3 tests
 f6a97ac Enhance config fixture to support registering options
 b9d2ee4 Cleanup config fixture docstrings
 b8a191b Add 'new' parameter to mock.Patch and mock.PatchObject classes
 45658e2 Fix violations of H302:import only modules
 6fa29ae Trivial: Make vertical white space after license header
 consistent
 12bcdb7 Remove vim header
 3970d46 Fix typos in oslo
 371fa42 Move LockFixture into a fixtures module

Change-Id: I87e9e51610f3d00e92755c4f40aa295e60e440fb
Use oslo-common's logging fixture

Make the unit tests raise an exception when there is a logging
formatting issue. Related to oslo BP
logging-handleerror-raise-exception

Change-Id: Id4aa4277c387f1b67db4209d467c570b3c630f29
Make baremetal driver use Flavor object instead of VirtAPI

This makes the baremetal driver use the Flavor object instead of
getting that information through the VirtAPI/conductor call.

Related to blueprint compute-manager-objects

Change-Id: I1cbc3fc77bbbcaa3c194f12814893c5937fb6e96
Make compute manager use Flavor object

This makes compute manager use the Flavor objects instead of a
raw conductor API to get information about flavors during resize.

Related to blueprint compute-manager-objects

Change-Id: Ieb56b754eb5a4824fc69093897bdff25ab020883
Make resource_tracker use Flavor object

This makes the resource_tracker use the Flavor object for getting
information about an instance's flavor instead of a raw call to
conductor.

Related to blueprint compute-manager-objects

Change-Id: Ida93eeed9b8f8f5da267cff6a6b38f6661479b36
Adds unit test for etc/nova/policy.json data

* Test live etc/nova/policy.json data
* Convert all actions in policy.json to admin-only actions
* Check that Policy auth exception is raised when all above actions are
  called using non-admin context

Change-Id: I1b97987f8e9e3bacc606385a56daad189cf6ce19
Closes-Bug: #1262325
Merge "Fix cache lock for image not consistent"
Merge "Refactoring metadata/base"
Make error notifications more consistent.

The error notifications sent by wrap_exception are a good source of
information when tracking down errors in the system. It is easy to spot
patterns in the errors by looking at similarities in the exceptions
raised.

This change looks at making the in-line error notifications
follow the same format, so they become equally useful.

Closes-Bug: #1251602
Change-Id: I1cd64a90ecefc64d12af05487eb6e45aa0362d69
Update Oslo wiki link in README

Use lastest Oslo wiki link.

Change-Id: If777b59754cfd7e1f0c151c4acc5dc4e16cd6687
Merge "Call get_pgsql_connection_info from _test_postgresql_opportunistically"
Merge "Prefix private methods with _ in docker driver"
Merge "Remove admin auth when getting the list of Neutron API extensions."