Merge "Extend Ceph dashboards"
diff --git a/.kitchen.travis.yml b/.kitchen.travis.yml
new file mode 100644
index 0000000..71548c3
--- /dev/null
+++ b/.kitchen.travis.yml
@@ -0,0 +1,6 @@
+suites:
+
+  - name: <%= ENV['SUITE'] %>
+    provisioner:
+      pillars-from-files:
+        ceph.sls: tests/pillar/<%= ENV['SUITE'] %>.sls
diff --git a/.travis.yml b/.travis.yml
index f1b5ed6..890ce1a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,16 +17,16 @@
   - bundle install
 
 env:
-#    - PLATFORM=trevorj/salty-whales:trusty
-    - PLATFORM=trevorj/salty-whales:xenial
-
+    - PLATFORM=trevorj/salty-whales:xenial SUITE=ceph_client_single
+    - PLATFORM=trevorj/salty-whales:xenial SUITE=ceph_mon_single
+    - PLATFORM=trevorj/salty-whales:xenial SUITE=ceph_osd_single
 
 before_script:
   - set -o pipefail
   - make test | tail
 
 script:
-  - test ! -e .kitchen.yml || bundle exec kitchen test -t tests/integration
+  - KITCHEN_LOCAL_YAML=.kitchen.travis.yml bundle exec kitchen test -t tests/integration
 
 notifications:
   webhooks:
diff --git a/ceph/common.sls b/ceph/common.sls
index 4e17805..d3ff157 100644
--- a/ceph/common.sls
+++ b/ceph/common.sls
@@ -4,6 +4,14 @@
   pkg.installed:
   - names: {{ common.pkgs }}
 
+base_config:
+  file.managed:
+  - name: /etc/ceph/ceph.conf
+  - source: salt://ceph/files/{{ common.version }}/ceph.conf.{{ grains.os_family }}
+  - template: jinja
+  - require:
+    - pkg: base_packages
+
 {% for keyring_name, keyring in common.get('keyring', {}).iteritems() %}
 
 /etc/ceph/ceph.client.{{ keyring_name }}.keyring:
diff --git a/ceph/init.sls b/ceph/init.sls
index 0fa4edd..524ff26 100644
--- a/ceph/init.sls
+++ b/ceph/init.sls
@@ -1,10 +1,10 @@
 include:
-{% if pillar.ceph.osd is defined %}
-- ceph.osd
-{% endif %}
 {% if pillar.ceph.mon is defined %}
 - ceph.mon
 {% endif %}
+{% if pillar.ceph.osd is defined %}
+- ceph.osd
+{% endif %}
 {% if pillar.ceph.setup is defined %}
 - ceph.setup
 {% endif %}
diff --git a/ceph/radosgw.sls b/ceph/radosgw.sls
index d0896c7..0fbb605 100644
--- a/ceph/radosgw.sls
+++ b/ceph/radosgw.sls
@@ -8,8 +8,9 @@
   pkg.installed:
   - names: {{ radosgw.pkgs }}
 
-/etc/ceph/ceph.conf:
+radosgw_config:
   file.managed:
+  - name: /etc/ceph/ceph.conf
   - source: salt://ceph/files/{{ common.version }}/ceph.conf.{{ grains.os_family }}
   - template: jinja
   - require:
diff --git a/ceph/setup/init.sls b/ceph/setup/init.sls
index e9c3e9a..07d3bcf 100644
--- a/ceph/setup/init.sls
+++ b/ceph/setup/init.sls
@@ -3,7 +3,7 @@
 
 include:
 - ceph.common
-{%- if setup.get('crush').enabled %}
+{%- if setup.get('crush') %}
 - ceph.setup.crush
 {%- endif %}
 {%- if setup.get('pool') %}
@@ -12,3 +12,5 @@
 {%- if common.get('keyring') %}
 - ceph.setup.keyring
 {%- endif %}
+
+{%- endif %}
diff --git a/ceph/setup/keyring.sls b/ceph/setup/keyring.sls
index 0a5b4c0..702200c 100644
--- a/ceph/setup/keyring.sls
+++ b/ceph/setup/keyring.sls
@@ -8,5 +8,3 @@
   - unless: ceph auth list | grep {{ keyring_name }}
 
 {%- endfor %}
-
-{%- endif %}
diff --git a/ceph/setup/pool.sls b/ceph/setup/pool.sls
index 1f7a40a..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 }}"
 
+{# 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 %}
+
 {%- for option_name, option_value in pool.iteritems() %}
 
-{%- if option_name != 'type' %}
+{%- if option_name not in ['type', 'pg_num'] %}
 
 ceph_pool_option_{{ pool_name }}_{{ option_name }}:
   cmd.run:
@@ -22,4 +30,3 @@
 
 {%- endfor %}
 
-