Conductor changes target_power_state before starting work

A race was discovered between when Nova requests a power state change
and when that request is visible in Ironic's API, which could lead to
Nova believing the request was completely satisfied before it
actually started.

A partial fix has been proposed to Nova:
    https://review.openstack.org/124162

This also requires that Ironic change the node's target_power_state from
within ConductorManager *prior* to spawning the background thread which
performs the actual work.

Looking into this exposed another potential race in Ironic whereby
a power state change request could be responded with 202-Accepted,
but the background thread might fail to be started, and no error would
be reported. The new behavior is to set node.last_error in the same
way that this is handled for provision state changes that fail in the
same way.

Change-Id: I4d85c9230bcd9b6e36ffa9a326fda9908fee7e76
Closes-bug: #1310135
Merge "Conductor changes target_power_state before starting work"