fix setup - set pg_num first
Change-Id: I31010795c2b26f30aff661d823f7d64c3336f109
diff --git a/ceph/setup/pool.sls b/ceph/setup/pool.sls
index 40da412..be2ace1 100644
--- a/ceph/setup/pool.sls
+++ b/ceph/setup/pool.sls
@@ -7,9 +7,17 @@
- name: ceph osd pool create {{ pool_name }} {{ pool.pg_num }}{% if pool.pgp_num is defined %} {{ pool.pgp_num }}{% endif %} {{ pool.type }}{% if pool.erasure_code_profile is defined %} {{ pool.erasure_code_profile }}{% endif %}{% if pool.crush_ruleset_name is defined %} {{ pool.crush_ruleset_name }}{% endif %}{% if pool.expected_num_objects is defined %} {{ pool.expected_num_objects }}{% endif %}
- unless: "ceph osd pool ls | grep ^{{ pool_name }}"
-{%- for option_name, option_value in pool|dictsort %}
+{# We need to ensure pg_num is applied first #}
+{%- if pool.get('pg_num') %}
+ceph_pool_option_{{ pool_name }}_pg_num_first:
+ cmd.run:
+ - name: ceph osd pool set {{ pool_name }} pg_num {{ pool.get('pg_num') }}
+ - unless: "ceph osd pool get {{ pool_name }} pg_num | grep 'pg_num: {{ pool.get('pg_num') }}'"
+{%- endif %}
-{%- if option_name != 'type' %}
+{%- for option_name, option_value in pool.iteritems() %}
+
+{%- if option_name not in ['type', 'pg_num'] %}
ceph_pool_option_{{ pool_name }}_{{ option_name }}:
cmd.run:
@@ -22,4 +30,3 @@
{%- endfor %}
-