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
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"
API to validate UUID parameters

The patch uses the UuidType in the wsexpose decorator to make WSME
validate whether UUIDs parameters are UUID-like strings. By doing that,
it solves the problem of allowing ports to be accessed by its address,
which is an inconsistence in our API.

As our UuidType now differs from the UuidType of WSME the patch also
removes the note to remove our custom type on the next WSME release.

Change-Id: I023e8f31d94555577c4573b4a5cf0d649d33b4fa
Closes-Bug: #1246816