The claiming part is fine, it is relying on BarclampLibrary::Barclamp::
Inventory::Disk.unclaimed(node) to provide the initial list that would
change the behavior.


On Tue, Jun 4, 2013 at 5:09 PM, Vincent Untz <notifications@github.com>wrote:

> In chef/data_bags/crowbar/bc-template-swift.json:
>
> > @@ -99,8 +99,8 @@
> >        "admin_ip_expr": "Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, \"admin\").address",
> >        "storage_ip_expr": "Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, \"storage\").address",
> >        "public_ip_expr": "Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, \"public\").address",
> > -      "disk_enum_expr": "node[\"crowbar\"][\"disks\"]",
> > -      "disk_test_expr": "v[\"usage\"] == \"Storage\"",
> > +        "disk_enum_expr": "r = Hash.new; BarclampLibrary::Barclamp::Inventory::Disk.unclaimed(node).each do |d| Chef::Log.info(\"Swift: Not claiming #{d.device}\") unless d.claim(\"Swift\") end; BarclampLibrary::Barclamp::Inventory::Disk.claimed(node,\"Swift\").each do |d| r[d.device]=d end; r",
> > +      "disk_test_expr": "true",
> >        "disk_zone_assign_expr":  "$rack_aware=Rack_awareness::By_switch.new(node) if $rack_aware.nil? ;[ $rack_aware.node_to_zone(params) , 99]"
>
> Ah, I see. I guess I missed that when reviewing the
> BarclampLibrary::Barclamp::Inventory::Disk API: I think I would expect
> Disk.claim("swift") to return true if the disk is already claimed by swift.
> This would lead to the same result as before. Or was there a reason to have
> the API return false in that case? (might be obvious, but it's midnight
> here ;-))
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/crowbar/barclamp-swift/pull/78/files#r4534668>
> .
>