]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
handler: do not test if pgs_num = 0
authorSébastien Han <seb@redhat.com>
Fri, 6 Oct 2017 12:59:23 +0000 (14:59 +0200)
committerSébastien Han <seb@redhat.com>
Fri, 6 Oct 2017 14:57:46 +0000 (16:57 +0200)
We don't need to wait if they are no PGS.

Signed-off-by: Sébastien Han <seb@redhat.com>
roles/ceph-defaults/templates/restart_osd_daemon.sh.j2

index 856464ffee900b140963478ec9ec9cf82212b448..4ad28c521fd8a71f128734ddecae798ba0ad9a3c 100644 (file)
@@ -5,6 +5,10 @@ DELAY="{{ handler_health_osd_check_delay }}"
 CEPH_CLI="--name client.bootstrap-osd --keyring /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring --cluster {{ cluster }}"
 
 check_pgs() {
+  num_pgs=$($docker_exec ceph $CEPH_CLI -s -f json|python -c 'import sys, json; print(json.load(sys.stdin)["pgmap"]["num_pgs"])')
+  if [[ "$num_pgs" == "0" ]]; then
+    return 0
+  fi
   while [ $RETRIES -ne 0 ]; do
     test "[""$($docker_exec ceph $CEPH_CLI -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["pgmap"]["num_pgs"])')""]" = "$($docker_exec ceph $CEPH_CLI -s -f json | python -c 'import sys, json; print [ i["count"] for i in json.load(sys.stdin)["pgmap"]["pgs_by_state"] if i["state_name"] == "active+clean"]')"
     RET=$?