Remove "node" parameter from methods handling power state in docs

This patch fixes the doc about methods handling power state
to remove the parameter "node".
* validate
* get_power_state
* set_power_state
* reboot

Change-Id: I5c0425e1502f304b62566aa1e63823214888ef66
Partial-Bug: #1312632
Pass kwargs to ClientWrapper's call() method

As the ClientWrapper class had no unittests some were added to test
the specific part of the code for this change. The FakeClient() and
associated classes from test_driver.py were moved to a common file to
make it easier to be imported and used by the new unittests.

Partial-bug: #1316549
Related-bug: #1309719
Change-Id: I11be25a6ce981e63027073d12fbf2922896f4693
list_instances() to return a list of instances names

Previously the list_instances() method in the Nova Ironic driver was
returning a list of instances UUIDs instead of a list of instances names
causing various checks throughout nova.compute.manager to always return
False for Ironic.

Closes-Bug: #1309719
Change-Id: I0ed29911f180f99a7e2b1c00ddd6c43064f04f7f
Merge "Remove "node" parameter from methods handling power state in docs"
Merge "Pass kwargs to ClientWrapper's call() method"
Merge "list_instances() to return a list of instances names"
Return the HTTP Location for newly created resources

To provide information about the location of a newly created resource
(201) the Ironic API now returns the URI for the new object in the HTTP
Location header.

A new function build_url() was created in the link.py by factoring out
part of the the Link.make_link() method so that we can reuse that part
of the code to build a URL without having to create a new Link object.

Partial-Bug: #1317044
Change-Id: I88b033d446aaed93fc90ab6497578d5cd729dea8
Return the HTTP Location for accepted requestes

After the server accepts a request (202) it now returns an URI in the
HTTP Location header so that clients will know how to track the status
of the request.

Closes-Bug: #1317044
Change-Id: I5286ed762426dea02a6513c0e31cbc9a8023f803
PXE driver to validate the requested image in Glance

This patch adds a check in the PXE driver validate() method to check if
the requested image exist in Glance and if it contains the 'kernel_id'
and 'ramdisk_id' properties set which are needed for the PXE boot.

Closes-Bug: #1324840
Change-Id: I42bf7fcb27286afb3db0fda2a3a09ea49c77496b
Log exceptions from deploy and tear_down

If deploy or tear_down raise an exception, an error is set on the Node
and visible in the API, but nothing is logged. This change adds
logging in the ConductorManager of exceptions raised from either
method.

Change-Id: I17a9328770b6fc9fce167a189d9692b5c4c2687f
Fix concurrent deletes in virt driver

The _unprovision function used a class member to track the number
of calls to ironic to check the provision state. When more than one
delete is happening concurrently, the deletes will both add to the
same counter. This commit fixes this issue to use a local counter.

Partial-Bug: #1326364

Change-Id: I2552332445fe0e614970ec28eddf7c1ae94e34be
Fix the logging message to identify node by uuid

The logging message of _build_pxe_config method in
ironic/drivers/modules/pxe.py is like below:
Building PXE config for deployment 4.

"4" is a ID of the node, but users don't know ID of the node
even if using CLI or API.
Users can know only uuid of the node.
So that, uuid of the node should be written in the logging message.

This patch makes identify node by uuid not by id.

Change-Id: Ida220a97d5fc8f6c5adc5b5acf239bbee14ff847
Closes-bug: #1327085
Reuse validate_instance_and_node() Nova ironic Driver

The driver already counts with a function called
validate_instance_and_node() that checks which node is associated to
a given instance and raises InstanceNotFound if the instance UUID is
not found in Ironic. The same functionality was being duplicate in many
other parts of the driver, this patch simply update those parts to use
the validate_instance_and_node() function.

Change-Id: I9a2f90c7cdd0fdfcc00d49a49581c61e4f073888
Fix AttributeError when calling create_engine()

The module which contains the create_engine() method is the sqlalchemy,
not slqalchemy.api.

Change-Id: I0b9e2f5b25f0c8ea9f7e55d863fa170cc9c09564
Partial-Bug: #1327225
Improving unit tests for _do_sync_power_state

Improve the unit tets coverage, and tightening up existing
tests surrounding the _do_sync_power_state method.

Change-Id: I9fd4c4c42936fcf8fc4f36bf35b6e691c495b8b0
Closes-bug: #1297404
Skip migrations test_walk_versions instead of pass

When there is no db engine configured for the migration tests,
the test_walk_versions test was passing, rather than skipping,
because it contained a for-loop and no check for the length of the
sequence being iterated over.

This patch checks the length of the configured engines and
properly skips the test when there are no engines.

Change-Id: I8a5c0a66f65a99c5169b251be02a8fbe6c727641
Closes-bug: #1327397
Add __init__.py for nova scheduler filters

To use these filters out of tree right now, you have to specify them in
nova's available_scheduler filters by full path. But in order for the
modules to be found and loaded, you must have an __init__.py.

Change-Id: I4816d9dbe0e93056792fad48e6228ffdd531e346
Cleanup mock patch without `with` part 2

A good idea because it makes the code easier to read to get rid of
the `with` using mock.patch and mock.patch.object in favor decorators,
where possible in the tests.

This patch affects Nova driver tests.

Change-Id: Ifd2e4d36c3cbcf82cb9b83c375ba0a3e98019adf
Mock seamicroclient lib in unit tests if not present

Mock the python-seamicroclient library from within ironic/tests/drivers
so that test_seamicro.py can import ironic/drivers/modules/seamicro.py
and run the unit tests on it, even when the external library is not
present.

Change-Id: I4f2cd75b2c64a5a280a5d45d5cea058fd432815b
Closes-bug: #1312321
Merge "Log exceptions from deploy and tear_down"