From 7e51e15182e904fa56d447bf8fbdd6da0845eed1 Mon Sep 17 00:00:00 2001 From: Christopher Baker Date: Mon, 17 Nov 2014 11:29:40 -0600 Subject: [PATCH 1/6] Added zap_disk option --- attributes/default.rb | 1 + recipes/osd.rb | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index e05bec6..0bad9a3 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -1,5 +1,6 @@ default['ceph']['install_debug'] = false default['ceph']['encrypted_data_bags'] = false +default['ceph']['zap_disk'] = false default['ceph']['install_repo'] = true diff --git a/recipes/osd.rb b/recipes/osd.rb index fc2f9c6..8cad066 100644 --- a/recipes/osd.rb +++ b/recipes/osd.rb @@ -91,8 +91,10 @@ # osd/$cluster-$id) # - $cluster should always be ceph # - The --dmcrypt option will be available starting w/ Cuttlefish + # - Set zap_disk to true to zap OSD disks before activation if node['ceph']['osd_devices'] devices = node['ceph']['osd_devices'] + zap_disk = node['ceph']['zap_disk'] == true ? '--zap-disk' : '' devices = Hash[(0...devices.size).zip devices] unless devices.kind_of? Hash @@ -112,7 +114,7 @@ dmcrypt = osd_device['encrypted'] == true ? '--dmcrypt' : '' execute "ceph-disk-prepare on #{osd_device['device']}" do - command "ceph-disk-prepare #{dmcrypt} #{osd_device['device']} #{osd_device['journal']}" + command "ceph-disk-prepare #{dmcrypt} #{zap_disk} #{osd_device['device']} #{osd_device['journal']}" action :run notifies :create, "ruby_block[save osd_device status #{index}]", :immediately end From a1ad920465cbf5e5649fede5d6e1de9b743df645 Mon Sep 17 00:00:00 2001 From: Christopher Baker Date: Mon, 17 Nov 2014 13:31:38 -0600 Subject: [PATCH 2/6] Zap disk only if OSD status set to 'zap-disk' --- attributes/default.rb | 1 - recipes/osd.rb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 0bad9a3..e05bec6 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -1,6 +1,5 @@ default['ceph']['install_debug'] = false default['ceph']['encrypted_data_bags'] = false -default['ceph']['zap_disk'] = false default['ceph']['install_repo'] = true diff --git a/recipes/osd.rb b/recipes/osd.rb index 8cad066..2156c05 100644 --- a/recipes/osd.rb +++ b/recipes/osd.rb @@ -94,7 +94,6 @@ # - Set zap_disk to true to zap OSD disks before activation if node['ceph']['osd_devices'] devices = node['ceph']['osd_devices'] - zap_disk = node['ceph']['zap_disk'] == true ? '--zap-disk' : '' devices = Hash[(0...devices.size).zip devices] unless devices.kind_of? Hash @@ -112,6 +111,7 @@ end dmcrypt = osd_device['encrypted'] == true ? '--dmcrypt' : '' + zap_disk = osd_device['status'] == 'zap-disk' ? '--zap-disk' : '' execute "ceph-disk-prepare on #{osd_device['device']}" do command "ceph-disk-prepare #{dmcrypt} #{zap_disk} #{osd_device['device']} #{osd_device['journal']}" From 213cb9d2cdbd876325dc421834f2cc67b9e32fa0 Mon Sep 17 00:00:00 2001 From: Christopher Baker Date: Mon, 17 Nov 2014 14:33:19 -0600 Subject: [PATCH 3/6] Update osd.rb --- recipes/osd.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/osd.rb b/recipes/osd.rb index 2156c05..9181b37 100644 --- a/recipes/osd.rb +++ b/recipes/osd.rb @@ -111,7 +111,7 @@ end dmcrypt = osd_device['encrypted'] == true ? '--dmcrypt' : '' - zap_disk = osd_device['status'] == 'zap-disk' ? '--zap-disk' : '' + zap_disk = osd_device['status'] == "zap-disk" ? '--zap-disk' : '' execute "ceph-disk-prepare on #{osd_device['device']}" do command "ceph-disk-prepare #{dmcrypt} #{zap_disk} #{osd_device['device']} #{osd_device['journal']}" From 523e3a5022ae54f0deb86bb81ff6255a4ba15630 Mon Sep 17 00:00:00 2001 From: Christopher Baker Date: Mon, 17 Nov 2014 14:52:49 -0600 Subject: [PATCH 4/6] Reverting previous change --- recipes/osd.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/osd.rb b/recipes/osd.rb index 9181b37..2156c05 100644 --- a/recipes/osd.rb +++ b/recipes/osd.rb @@ -111,7 +111,7 @@ end dmcrypt = osd_device['encrypted'] == true ? '--dmcrypt' : '' - zap_disk = osd_device['status'] == "zap-disk" ? '--zap-disk' : '' + zap_disk = osd_device['status'] == 'zap-disk' ? '--zap-disk' : '' execute "ceph-disk-prepare on #{osd_device['device']}" do command "ceph-disk-prepare #{dmcrypt} #{zap_disk} #{osd_device['device']} #{osd_device['journal']}" From c8f9b2c7f20adb65fc406a10e6e0696d32c3d9ff Mon Sep 17 00:00:00 2001 From: Christopher Baker Date: Mon, 17 Nov 2014 14:59:43 -0600 Subject: [PATCH 5/6] Changing string comparison method --- recipes/osd.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/osd.rb b/recipes/osd.rb index 2156c05..8d12383 100644 --- a/recipes/osd.rb +++ b/recipes/osd.rb @@ -111,7 +111,7 @@ end dmcrypt = osd_device['encrypted'] == true ? '--dmcrypt' : '' - zap_disk = osd_device['status'] == 'zap-disk' ? '--zap-disk' : '' + zap_disk = (osd_device['status'].eq? "zap-disk") ? '--zap-disk' : '' execute "ceph-disk-prepare on #{osd_device['device']}" do command "ceph-disk-prepare #{dmcrypt} #{zap_disk} #{osd_device['device']} #{osd_device['journal']}" From 80b68721d9daaeb11006fb392b05c89d75d29bc3 Mon Sep 17 00:00:00 2001 From: Christopher Baker Date: Mon, 17 Nov 2014 16:15:05 -0600 Subject: [PATCH 6/6] Use single quotes instead of double for comparison --- recipes/osd.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/osd.rb b/recipes/osd.rb index 8d12383..42cf5c7 100644 --- a/recipes/osd.rb +++ b/recipes/osd.rb @@ -111,7 +111,7 @@ end dmcrypt = osd_device['encrypted'] == true ? '--dmcrypt' : '' - zap_disk = (osd_device['status'].eq? "zap-disk") ? '--zap-disk' : '' + zap_disk = (osd_device['status'].eq? 'zap-disk') ? '--zap-disk' : '' execute "ceph-disk-prepare on #{osd_device['device']}" do command "ceph-disk-prepare #{dmcrypt} #{zap_disk} #{osd_device['device']} #{osd_device['journal']}"