]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cookbooks.git/commitdiff
Fix timing issue with ceph pool create 207/head
authormick.mccarthy <mick.mccarthy@workday.com>
Wed, 5 Aug 2015 14:38:57 +0000 (15:38 +0100)
committermick.mccarthy <mick.mccarthy@workday.com>
Thu, 6 Aug 2015 09:38:26 +0000 (10:38 +0100)
There are scenarios being encountered where ceph::mon attempts to create
pools before all the required ceph services are up and running. This
causes the recipe to fail.

My proposed solution to this issue is to remove the 'ceph pool create'
block from the ceph::mon recipe and place it in it's own separate recipe
(ceph::pools), which is placed below ceph::mon in the runlist for the role
(ceph-mon.json).

Having this code in a separate recipe allows better control of when the
pools are created.

recipes/mon.rb
recipes/pools.rb [new file with mode: 0644]
roles/ceph-mon.json

index 15f2fba68a29b40265d03c277cb81d279a86bd9b..7e0cc1d0594bf01581dbf96a223ec310af7a225d 100644 (file)
@@ -130,13 +130,3 @@ execute 'add bootstrap-osd key to keyring' do
   command lazy { "ceph-authtool '#{keyring}' --name=client.bootstrap-osd --add-key='#{osd_secret}' --cap mon 'allow profile bootstrap-osd'  --cap osd 'allow profile bootstrap-osd'" }
   only_if { osd_secret }
 end
-
-if node['ceph']['user_pools']
-  # Create user-defined pools
-  node['ceph']['user_pools'].each do |pool|
-    ceph_pool pool['name'] do
-      pg_num pool['pg_num']
-      create_options pool['create_options'] if pool['create_options']
-    end
-  end
-end
diff --git a/recipes/pools.rb b/recipes/pools.rb
new file mode 100644 (file)
index 0000000..d33cb41
--- /dev/null
@@ -0,0 +1,19 @@
+# Author:: mick-m <mick-m@users.noreply.github.com>
+# Cookbook Name:: ceph
+# Recipe:: pools
+#
+# Copyright 2015, Workday
+#
+# This recipe creates user-defined Ceph pools defined in the Chef environment.
+# Having this code in a separate recipe allows better control of when the pools
+# are created.
+
+if node['ceph']['user_pools']
+  node['ceph']['user_pools'].each do |pool|
+    # Create user-defined pools
+    ceph_pool pool['name'] do
+      pg_num pool['pg_num']
+      create_options pool['create_options'] if pool['create_options']
+    end
+  end
+end
index ada41de80fb64134eb925a46dd07c1d7190408c2..5e610e0dcb6fff56203369ccbbb4315cec57d945 100644 (file)
@@ -4,6 +4,7 @@
   "description": "Ceph Monitor",
   "run_list": [
     "recipe[ceph::repo]",
-    "recipe[ceph::mon]"
+    "recipe[ceph::mon]",
+    "recipe[ceph:pools]
   ]
 }