crowbar/barclamp-crowbar — pull request #788 by cloudedge (2013-11-29 23:41:24+00:00)
Title: Node.hint allows you to request IP (and other attributes) when Node is created in API [1/3]

I added this for working with Docker where we cannot set the IP; however, the implementation of hint enables some
really awesome capabilities (not implemented, but now possible). I have choosen to narrowly implement only the IP
feature.

This pull includes BOTH docs and bdd tests for this capability in crowbar & network!

The first part in the crowbar framework is to add .hint to nodes and expose this in the API. I added a helper for the most common usecase - requesting an admin network IP address.

The second part is to have the network role handler use the hint when it allocates the network IP address.
The allocation part already had logic for suggesting an IP that we were not using until now. In this case, I simply use the hint to pass in the optional suggestion parameter.

Overall, a very surgical change for a major feature addition.

In the future, hinting can be used to allow users to request operating system, MAC-Name maps, RAID configs and even workloads when a node is created.
The pattern for this is to add a category for the role doing the operations (e.g.: provisioner-os-installed) and then a key-value pair that the role
would implment ("os=>OpenSuse-13.1") or similar.

For the MAC-Name mapping, the deployer would use the hint to pre-create the DHCP entry.

BDD/bdd_restrat.erl | 12 ++++++++++--
BDD/crowbar.erl | 7 ++++++-
BDD/features/node.feature | 8 +++++++-
.../app/assets/stylesheets/_tables.sass | 12 +++++++-----
.../app/controllers/nodes_controller.rb | 5 +++++
crowbar_framework/app/models/node.rb | 13 +++----------
.../app/views/snapshots/show.html.haml | 4 ++--
doc/devguide/model/node.md | 10 +++++++++-
8 files changed, 49 insertions(+), 22 deletions(-)

Crowbar-Pull-ID: 5a75eba6eb8ed557dfb21f1c50c4eef5c4188bcd

Crowbar-Release: development