Merge the tip of origin/release/proposed/2019.2.0 into origin/release/2019.2.0

6fb7a50 Use local pip storage for offline deploy
406b58a [ceph] fix issue with upmap used for adding missing osd

Change-Id: Ic90b99702ed460714a1d9301a3ae3183dfd5092a
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)
+            }
         }
     }
 }
diff --git a/src/com/mirantis/mk/Python.groovy b/src/com/mirantis/mk/Python.groovy
index 29288f9..9839f4a 100644
--- a/src/com/mirantis/mk/Python.groovy
+++ b/src/com/mirantis/mk/Python.groovy
@@ -53,7 +53,12 @@
         writeFile file: "${path}/requirements.txt", text: args
         reqs_path = "${path}/requirements.txt"
     }
-    runVirtualenvCommand(path, "pip install -r ${reqs_path}", true)
+    
+    def install_cmd = 'pip install'
+    if (offlineDeployment) {
+        install_cmd += " --find-links=/opt/pip-mirror "
+    }
+    runVirtualenvCommand(path, "${install_cmd} -r ${reqs_path}", true)
 }
 
 /**