Add prepare, clean_up, take_over methods to deploy

Add three new methods to the deploy interface,
which will be used by the ConductorManager to trigger
(re)building of the deploy environment and updating of
external mappings/dependencies when rebalancing the hash ring.

Also refactors the PXE driver to utilize these new methods.

blueprint instance-mapping-by-consistent-hash

Change-Id: I1bebb895cbe29a7059a9873ef90ee039790c1031
Check connectivity in SSH driver 'validate' method

Connection check for provided credentials added to 'validate' method
of SSH power driver.

Partial-Bug: #1255648
Change-Id: I687d3b0edd5629139cedc3fc63029128d9226728
Improve error handling in validate_vendor_action

validate_vendor_action method of conductor may be used for validate
callback data from deploy/maintenance ramdisk, error message not
saved in Ironic for this case.
This patch adds saving for error message to node.last_error.

Change-Id: Ic01a6f9a95c7e09e7ce7925dad9a7fd228de65bd
Convert trycmd() to oslo's processutils

trycmd() have been moved into oslo and is already imported in Ironic,
this patch changes our custom trycmd() function to use the one from
oslo's processutils.

Change-Id: I9df6d62d1729c3763d980b8ae38b399dce18e66b
Move and rename ValidTypes

Move the ValidTypes class from v1/utils.py to the v1/types.py file which
should contain everything related to wsme types in our API.

This patch also renames the ValidTypes class to MultiType because
it reflects better what this type about, it's a type that validates
multiple types and is more consistent with the other types names: Ending
with the word "Type" (singular).

Change-Id: I5ea5968bc3969f081bdf314771111e904462d195
Avoid a race when associating instance_uuid

Current code can potentially overwrite the instance_uuid without
exception when multiple dbapi.update_node calls are issued. This
patch adds a check to dbapi so that the NodeAssociated exception
will be raised in this case.
The Nova Ironic driver will handle this exception. This will be
introduced in a separate patch.

Change-Id: I28ef5ce55399bde7073ffc111e9bc4400e5577ee
Partial-Bug: #1244541
Fix wrong message of MACAlreadyExists

Closes-Bug: #1264127
Change-Id: I315aa16fd82485b13d8d3bda56a2e0d1f368b937
Merge "Improve error handling in validate_vendor_action"
Merge "Avoid a race when associating instance_uuid"
Merge "Check connectivity in SSH driver 'validate' method"
Make param names more consistent in API

Param names for resource ids were inconsistent in the API. This patch
converts them to *_uuid form.

Closes-Bug: #1259619
Change-Id: Icb6cb1f9ebab7c9d516ec297eeee6f2db8b52eb2
Improve error handling in PXE _continue_deploy

Related to bug 1184470, there was a concern that the PXE driver
may not be adequately handling errors and informing users when failures
occur mid-deploy.

This patch refactors the _continue_deploy() method to handle both errors
POSTed from the ramdisk and errors that originate within deploy_utils.

It also fixes an inconsistency in the final provisioning_state:
ConductorManager.do_node_deploy() will set provisioning_state = ACTIVE,
however the PXE driver was leaving nodes with state = DEPLOYDONE.

Change-Id: I29cbff87cbaf85d95687ae094720f8b99f33b65f
Related-bug: 1184470
Add unit tests for get_nodeinfo_list

Complete the TODO for adding unit tests to get_nodeinfo_list.

Change-Id: Ieb7b52f0bdabef7b052a9d9f35d8dd3797bc3ac3
Merge "Add prepare, clean_up, take_over methods to deploy"
Merge "Convert trycmd() to oslo's processutils"
Merge "Move and rename ValidTypes"
Make chassis_uuid field of nodes optional

Currently chassis is not being used by Ironic, it's nice to have it in
our API as a pre-design for grouping nodes that shares some capabilities
(e.g nodes that shares the firmware) or just as a way of grouping the
nodes for organization purpose. It shouldn't be mandatory to specify a
chassis uuid when creating one node since it might be difficult for other
things, eg. migration from Nova. Nova doesn't have a similar abstraction,
so it's impossible to determine which chassis the node belongs to when
migrating from it. So, this patch is making the chassis_uuid field of nodes
optional.

Change-Id: I9fe657ab11d809271eea44d734a5986655a5b303
Merge "Add unit tests for get_nodeinfo_list"
Merge "Make param names more consistent in API"
Merge "Make chassis_uuid field of nodes optional"