Add a more useful logger.
Add our own transaction method.

It makes serializable the default isolation level for a transaction,
retries transactions automatically on serialization failures, and
tries up to 3 times to resolve deadlock-related failures.

It also allows us to declare that a transaction should be read-only,
where we want to read data in a fashion that is compatible with
everything else being serialized.

We also add a locked_transaction method that takes a table lock on the
table associated with the class.
Expose most of the node creation magic via the API.

This exposes the internal machinery that Crowbar uses create nodes and
bind their initial noderoles.  Instead of POSTing to /api/v2/nodes and
being handed back a fully fledged node, we now need a few different API
calls:

* POST to /api/v2/nodes to create a basic Node object.  This will not
  have any roles bound to it nor will it have any addresses from the
  admin network assigned to it. The node will neither be alove nor available.
* (Optional) PUT any node-specific hints that may be needed for the
  bootstrap process, including node MAC addresses or your suggested IP
  address.
* POST to /api/v2/node_roles to bind default roles to the node.  Binding
  crowbar-admin-node will result in the node having all the roles needed
  for it to act as an admin node, and crowbar-managed-node will bind all
  the roles needed for the Sledgehammer discovery process to work.
* (Optional) PUT any node-specific attrib updates to the node.
* PUT to /api/v2/nodes/<node_name>/commit to move all the node's
  noderoles from PROPOSED to TODO, and mark the node as available (but
  still not alive)

At this point, the node is ready to be marked as alive to let the
annealer start running noderoles on it.
Fix some Jig-related deadlocks exposed by the Node creation rework.

Splitting the Node creation into several components exposed a locking
error in the Run management code that could cause the framework to
deadlock.  To alleviate this, the Run model and related code has been
updated to:

* Rework the Jig exception management stuff to consolidate it even
  more.  Everything that needs to happen with a noderole to make a Jig
  do work now happens inside of delayed_jobs, and any exception will
  throw the noderole into ERROR.  This also zaps the added boilerplate
  that was added in the last jig rework.  The bulk of the change deals
  with the indentation changes for this work.
* Reworked all the locations that were calling Run.run! to ensure that
  Run.run! is never called inside of a transaction.  Going forward this
  invariant will be enforced by the Run.locked_transaction class method,
  which will throw an error if it is called inside another transaction.
* Changed the on_node_* hooks to be called via after_commit.  This
  makes it easier for hooks that need to call Run.enqueue to schedule
  will not inadvertently be inside a transaction.
Move NodeRole on_<state> handling to the after_commit hook.

This lets the on_<state> hooks run after all the relavent node role
state graph changes have been saved and committed, which ensures that
they all see the graph in a state that is consistent with how they were
called.  It also allows the hooks to do things (like allocating IP
addresses) that need exclusive table access without risking a nested
transaction related deadlock.
Change node_role state machine manipulation

Switch from from guarding via the state= method to having explicit test
and set methods per state. This makes the code slightly easier to reason
about. and swaps out one long complex method for several smaller and
simpler ones.
Simplify role.add_to_snapshot
Lock node_roles when binding initial roles.

This avoids several evil sources of deadlock when creating a whole bunch
of nodes at once.
Let us transition from transition.

This covers a corner case that can happen when one of the roles enqueues
a run manually.
Report the exception class in the error from a Jig run.

This is mainly useful for when the framework side of things fails in a
delayed_job run so that we don't inadvertently lose the exception or its context.
Run the barclamp import process in one transaction.

This makes it a bit faster and much more logically consistent -- either
all of the roles, jigs, and metadata for a barclamp are loaded into the
framework, or none of them are.
Decrease database churn for role manipulation.

Add an auxilliary view that expresses all of the parents and children of
the role graph (similar to the one for the node_role graph), and use it
whereever we want to loop over all of the parents or children of a role.
Wrap more Node-related actions in transactions.

This helps with UI coverage to make sure it does things as atomically as feasible.
Make Run.enqueue be smarter about not doing work,

Modify the Run model to carry around the data that will be passed to a
jig run, and modufy Run.enqueue to let update the data in a
previously-queued run if it can instead of always creating a new one.
Make NodeRole state change methods transaction-friendly
Get rid of having multiple snapshots.

We were not actually using snapshots for their original goals, and
having them and their associated machinery adds a fair amount of extra
complexity that we don't need.

For now, deployments have exactly one snapshot and node_role_datum is
gone.  A future pull request will fold snapshots into deployments.
Have barclamp_dns lock any noderoles it is going to update
Wrap node twiddlings for os_install in a transaction
Merge pull request #74 from VictorLowther/node-create-api-rework

+2 Node create api rework