Wait for baremetal deploy inside driver.spawn

Previously, baremetal driver.spawn returned as soon as the
machine power turned on, but before the user-image was deployed to the
hardware node, and long before the node was available on the network.
This meant the nova instance was marked as ACTIVE before provisioning
had actually finished. If the deploy failed and the baremetal node was
set to an ERROR state, the nova instance could still be left as ACTIVE
and the user was never informed of the error.

This patch introduces a LoopingCall to monitor the deployment status in
the baremetal database. As the deployment is performed by
nova-baremetal-deploy-helper, the database record is updated. Once the
deployment is complete, driver.spawn() sets the baremetal node status
and the nova instance status is also set properly. If an error occurs
during the deployment, an exception is raised within driver.spawn()
allowing nova to follow the normal cleanup and notify paths.

This also allows the baremetal PXE driver to delete cached image files
when a baremetal deployment fails.

Fixes bug 1088655.

Change-Id: I4feefd462fd956c9780995ec8b05b13e78278c8b
Better error handling in baremetal spawn & destroy

Improve the exception handling in baremetal driver spawn and destroy.

Adds unit tests for destroy to check that bm_node is disassociated
from instance_uuid only when destroy succeeds, and is set to ERROR state
(but still associated) if any exception is not handled.

Change-Id: I75853210d4883b352da9876a682dbb7288689541
Improve performance of baremetal list_instances.

This patch adds two new methods to baremetal/db/api:
 - bm_node_get_associated
 - bm_node_get_unassociated
which return a list of nodes either associated or not associated to a
Nova instance, as determined by the instance_uuid field, respectively.

Now, list_instances and get_available_nodes methods only fetch assocated
and unassociated nodes from the baremetal database, instead of fetching
all nodes.

Change-Id: Ib875d26d7b85a9dbf08c925a89802e2cd614e363
Merge "Wait for baremetal deploy inside driver.spawn"
Merge "Better error handling in baremetal spawn & destroy"
Merge "Improve performance of baremetal list_instances."
Merge remote-tracking branch 'm_src_repo/master' into build-temp