[ceph] fix issue with upmap used for adding missing osd

Related-Prod: PROD-36764
Change-Id: I1e6891b6800b7b9b6068101cb6f1924a6d0c1f8f
diff --git a/src/com/mirantis/mk/Ceph.groovy b/src/com/mirantis/mk/Ceph.groovy
index 957b438..7735394 100644
--- a/src/com/mirantis/mk/Ceph.groovy
+++ b/src/com/mirantis/mk/Ceph.groovy
@@ -306,10 +306,15 @@
     for(pg in pgmap) {
         pg_new = pg["up"].minus(pg["acting"])
         pg_old = pg["acting"].minus(pg["up"])
-        for(int i = 0; i < pg_new.size(); i++) {
-            // def string = "ceph osd pg-upmap-items " + pg["pgid"].toString() + " " + pg_new[i] + " " + pg_old[i] + ";"
-            def string = "ceph osd pg-upmap-items ${pg["pgid"]} ${pg_new[i]} ${pg_old[i]}"
-            map.add(string)
+        if(pg_old.isEmpty()) {
+            // use standard rebalancing to just fill gaps with new osds
+            unsetFlags('norebalance')
+        }
+        else {
+            for(int i = 0; i < pg_new.size(); i++) {
+                def string = "ceph osd pg-upmap-items ${pg["pgid"]} ${pg_new[i]} ${pg_old[i]}"
+                map.add(string)
+            }
         }
     }
 }