Sync oslo/common/excutils

Sync commits:
  6d0a6c3083218cdac52758a8b6aac6b03402c658
  8b2b0b743e84ceed7841cf470afed6a5da8e1d07
  fcf517d72cb81f972fad20caa9ff0341e9b4aa9c
  33a2cee6a690ecfdb2cecfe8f01b0b1dacb5bd17

Change-Id: I4f12aecf558baf0004ceed65f55520850534b73c
Remove hardcoded node id value

Change-Id: I9e4e74ce3a41e1cd3dd4e0d9ff1d1bde0656527f
Closes-Bug: 1306214
nova.virt.ironic passes ephemeral_gb to ironic

Make the nova.virt.ironic driver pass the ephemeral_gb flavor spec, if
present, to Ironic via driver_info/pxe_ephemeral_gb. Will also forward
the CONF.default_ephemeral_format value to Ironic.

This patch also adds a default ephemeral format CONF option to
ironic.drivers.modules.pxe, just in case this isn't sent from Nova, eg.
because the config option has no default value.

Closes-bug: #1307726
Change-Id: I445965540c95db7a80c7f8da88e9d4218dcc8f01
Clean up calls to get_node()

This patch removes all direct calls to dbapi's get_node(). They are
replaced either by Node.get(), Node.get_by_id(), or Node.get_by_uuid()
calls.

Additional detail about the changes:

1) Break DBAPI get_node() into get_node_by_id() and get_node_by_uuid().
   Let's be explicit about which type we're passing. This allows
   Node.get_by_uuid() to work exactly how its named. Also, do not
   return an object from the DB API calls. The Node object itself will
   do the conversion.
2) Adds Node.get_by_id() to compliment the current Node.get_by_uuid()
   for places you are querying by the ID.
3) Adds Node.get() so that you can still have a single method to use
   to pass either and ID or a UUID.
4) Make all of the Node.get* calls set the 'context' so that you can
   later just node.save() without passing it. Doc strings have been
   updated to clarify what 'context' is for.

Change-Id: I995891b1645056a5b15c48e37b8bcd1e299ac468
Document ClusteredComputeManager

Document the option needed to enable the ClusteredComputeManager in
nova.conf.

The commit a719472d added a custom compute manager to Ironic which
prevents some startups problem (e.g do not cause n-cpu to die at startup
if Ironic is not running yet) and workaround some frictions that we have
with Nova which assumes that each n-cpu is the only one responsible for
an instance (which is not true in the Ironic model).

Change-Id: I26bf5a1d3b634788044991e4524f64acf23bed9a
Merge "Clean up calls to get_node()"
Spawn support for TaskManager and 2 locking fixes

There's a number of cases where we grab a lock and then spawn a worker
to complete an action. Since the TaskManager() is not being used as a
context manager in these cases, it's really easy to mess this up and
create a code path where we accidentally leave a node locked.

This patch adds support to TaskManager to allow you to spawn a worker
on __exit__. This consolidates all of the logic to make sure we unlock
a node when we should. All cases where we lock and spawn a worker have
been updated to use this.

This happens to fix a bug in set_console_mode() where there's a path
that can leave a node locked. If the console is already in the
appropriate mode, it doesn't spawn a worker, however it would leave
the node locked.

This also fixes a bug in _check_deploy_timeouts() where if the spawn
failed due to something other than NoFreeConductorWorkers or if
the thread-finished-callback linking failed, we would leave a node
locked.

Tests where we're actually testing eventlet's thread behavior with
respect to link() have been moved to the task_manager test file.
They were refactored to remove unnecessary sleeps and incorrect
assumptions about eventlet scheduling. (They assumed that a spawn()
scheduled the new thread immediately.)

self._spawn_worker() tests in test_manager were also moved to their own
test class to be true unit tests.

Change-Id: I6b4ce46e8d1a67a6e1673cc9256b5da3eae3ff32
Update Ironic User Guide post landing for 41af7d6b

This patch is a post landing for 41af7d6b741a5a24e2cd212ab543b0b5be105551
Fixing:
Update logical architecture diagram
Brief description of Ironic service
Bullet points

Change-Id: I177041fa7db035d95a93e6345faa64177dbf888e
Overwrite instance_exists in Nova Ironic Driver

The default implementation is very inefficient, it calls list_instances()
which fetches the complete list from Ironic. This patch is overwritten
the default method making it use a single GET to fetch the node which
contains that instance associated.

Closes-Bug: #1309599
Change-Id: I0601624455ed4390233da26f63e576cadaf75a1e
Merge "Sync oslo/common/excutils"
Drivers may expose a top-level passthru API

This allows drivers to implement a vendor method which will be executed on a
random conductor upon any POST to
/drivers/<driver_name>/vendor_passthru/<method_name>, where <method_name> is
an arbitrary path segment which will be passed to the driver_vendor_passthru
method on the vendor interface.

Implements: blueprint nodeless-vendor-passthru
Change-Id: Ia0866e9ca59c8eba7e52eabeb8c88076c54ebbfc
Merge "Spawn support for TaskManager and 2 locking fixes"
Merge "Drivers may expose a top-level passthru API"
Port to oslo.messaging

The oslo.messaging library takes the existing RPC code from oslo and
wraps it in a sane API with well defined semantics around which we can
make a commitment to retain compatibility in future.

The patch is large and hard to be split into different patches, but the
changes can be summarized as:

* Remove openstack/common/{rpc, notifier, log_handler} modules dependency
(superceded by oslo.messaging)

* New config option `conductor.workers_pool_size` add to determine the
size of the workers greenthread pool.

* PeriodicService class refactored and renamed to RPCService, all periodic
tasks methods were moved to the ConductorManager class leaving RPCService
class to be resposable for setting up and starting the RPCServer from
oslo.messaging only.

* In oslo.messaging, a request context is expected to be a dict so the
method RequestContext.{to,from}_dict() was updated/added to the module.

* The allowed_rpc_exception_modules configuration option is replaced
by an allowed_remote_exmods get_transport() parameter. This is not
something that users ever need to configure, but it is something each
project using oslo.messaging needs to be able to customize.

* New common/rpc.py module added to wrap the global messaging state. It
also contains transport aliases for backwards compatibility with IceHouse
rpc_backend configuration values.

blueprint: oslo-messaging
Change-Id: I454e8898baed002a1cddb9eb76492ae9c2f1212b
Merge "nova.virt.ironic passes ephemeral_gb to ironic"
Updated from global requirements

Change-Id: I828599fce9c90c91b1a2939be42e10fde515b3ff
Merge "Update Ironic User Guide post landing for 41af7d6b"
Merge "Port to oslo.messaging"
Merge "Updated from global requirements"
Fix bypassed reference to node state values

The nova.virt.ironic driver was bypassing the defined set of node
states and using a literal value. This fixes it to reference the
proper state.

Change-Id: I1f61d1be2e86f659b903c2376233427c0778c38a