crowbar/barclamp-nova — pull request #153 by VictorLowther (2013-06-03 16:50:19+00:00)
Title: Rework how we allocate disks to barclamps. Will close DE1120 and DE1162. [4/8]

For many releases, Crowbar has built node[:crowbar][:disks] at node
discovery time, and the Chef cookbooks have used what is in that array
to determine what drives they can use. This scheme has a few
shortcomings:

1 The code always assumed that /dev/sda was going to be the boot
device.
2 The list was built at discovery time, and so it was blind to any
changes in the disk topology that would happen when the raid
barclamp did its thing
3 The only choices for a disk role were OS and Storage, leading to
all sorts of fun when multiple roles wanted to grab a physical
disk or twenty to get all Big Data.

To fix the above shortcomings, I have replaced node[:crowbar][:disks]
with a set of methods on the
BarclampInventory::Barclamp::Inventory::Disk class (and its objects)
that let you:

1 Get a list of all unclaimed fixed nonremovable disks on a node.
2 Get a list of all disks that have been claimed by a barclamp on a
node.
3 Claim a disk for a barclamp.
4 Release a claim for a disk.

To make sure that the claims for a disk stay relatively sane, there
are some restrictions on when you can claim a disk:

1 You cannot claim a disk before the RAID barclamp has finished
making any changes it is going to make to a system.
2 You can only make and release claims to a disk on the node that
has the disk. In practice, this means that the only place you can
claim a disk is in a recipe running on the node that has the disks
to be claimed or released.

How it is implemented:

All claims to a disk are tracked on
node[:crowbar_wall][:claimed_disks][disk.unique_name]
disk.unique_name is a method that looks up as unique a name as
possible for the disk, making the claim and release machinery as
insensitive to the vagaries of device naming as you can reasonably get
on a modern Linux system.

chef/cookbooks/nova/attributes/default.rb | 6 -
chef/cookbooks/nova/files/default/eqlx.py | 374 --------------------
chef/cookbooks/nova/recipes/api.rb | 24 --
chef/cookbooks/nova/recipes/config.rb | 9 -
chef/cookbooks/nova/recipes/use_volume.rb | 183 ----------
chef/cookbooks/nova/recipes/volume.rb | 23 --
.../cookbooks/nova/templates/default/nova.conf.erb | 13 -
chef/data_bags/crowbar/bc-template-nova.json | 22 --
chef/data_bags/crowbar/bc-template-nova.schema | 30 --
.../app/controllers/nova_controller.rb | 11 -
crowbar_framework/app/models/nova_service.rb | 16 +-
.../views/barclamp/nova/_edit_attributes.html.haml | 1 -
12 files changed, 2 insertions(+), 710 deletions(-)

Crowbar-Pull-ID: af9a80a504bf66b9f098a6eb589cb881facd40d3

Crowbar-Release: pebbles