Merge "Adding cvp-ha job code Requires https://gerrit.mcp.mirantis.net/#/c/12283/ Change-Id: Ib12659ed34ec3dfdfe6b20d7e085dbd8f38b0be2"
diff --git a/generate-cookiecutter-products.groovy b/generate-cookiecutter-products.groovy
index f94965d..ab24db0 100644
--- a/generate-cookiecutter-products.groovy
+++ b/generate-cookiecutter-products.groovy
@@ -142,9 +142,11 @@
             // apt package genisoimage is required for this stage
 
             // download create-config-drive
-            def config_drive_script_url = "https://raw.githubusercontent.com/jiribroulik/scripts/master/create_config_drive.sh"
+            // FIXME: that should be refactored, to use git clone - to be able download it from custom repo.
+            def config_drive_script_url = "https://raw.githubusercontent.com/Mirantis/mcp-common-scripts/master/config-drive/create_config_drive.sh"
+            def user_data_script_url = "https://raw.githubusercontent.com/Mirantis/mcp-common-scripts/master/config-drive/master_config.sh"
+
             sh "wget -O create-config-drive ${config_drive_script_url} && chmod +x create-config-drive"
-            def user_data_script_url = "https://raw.githubusercontent.com/mceloud/scripts/master/master_config.sh"
             sh "wget -O user_data.sh ${user_data_script_url}"
 
             sh "git clone https://github.com/Mirantis/mk-pipelines.git ${pipelineEnv}/mk-pipelines"
@@ -172,7 +174,7 @@
 
             if (templateContext.default_context.offline_deployment && templateContext.default_context.offline_deployment == 'True'){
                 def aptlyServerHostname = templateContext.default_context.aptly_server_hostname
-                def user_data_script_apt_url = "https://raw.githubusercontent.com/richardfelkl/scripts/master/mirror_config.sh"
+                def user_data_script_apt_url = "https://raw.githubusercontent.com/Mirantis/mcp-common-scripts/master/config-drive/mirror_config.sh"
                 sh "wget -O mirror_config.sh ${user_data_script_apt_url}"
 
                 def smc_apt = [:]
diff --git a/openstack-compute-install.groovy b/openstack-compute-install.groovy
index 82a3e40..3cf6aaa 100644
--- a/openstack-compute-install.groovy
+++ b/openstack-compute-install.groovy
@@ -39,13 +39,13 @@
         }
 
         stage("Trusty workaround") {
-            if(salt.getGrain(saltMaster, minions[0], "oscodename")['return'][0].values()[0]["oscodename"] == "trusty") {
+            if(salt.getGrain(pepperEnv, minions[0], "oscodename")['return'][0].values()[0]["oscodename"] == "trusty") {
                 common.infoMsg("First node %nodename% has trusty")
                 common.infoMsg("Assuming trusty on all cluster, running extra network states...")
                 common.infoMsg("Network iteration #1. Bonding")
-                salt.enforceState(saltMaster, targetLiveAll, 'linux.network', true)
+                salt.enforceState(pepperEnv, targetLiveAll, 'linux.network', true)
                 common.infoMsg("Network iteration #2. Vlan tagging and bridging")
-                salt.enforceState(saltMaster, targetLiveAll, 'linux.network', true)
+                salt.enforceState(pepperEnv, targetLiveAll, 'linux.network', true)
             }
         }
 
diff --git a/openstack-control-upgrade.groovy b/openstack-control-upgrade.groovy
index b121d0b..0c13b05 100644
--- a/openstack-control-upgrade.groovy
+++ b/openstack-control-upgrade.groovy
@@ -251,7 +251,7 @@
                 node_count++
             }
             def control_general_target = ""
-            def control_target_hosts = salt.getMinions(pepperEnv, 'I@keystone:server and not upg*')
+            def control_target_hosts = salt.getMinions(pepperEnv, 'I@keystone:server and not upg*').sort()
             node_count = 1
 
             for (t in control_target_hosts) {
diff --git a/test-run-rally.groovy b/test-run-rally.groovy
index d92d988..71e5f8b 100644
--- a/test-run-rally.groovy
+++ b/test-run-rally.groovy
@@ -9,6 +9,7 @@
  *   IMAGE_LINK                      Link to docker image with Rally
  *   RALLY_SCENARIO                  Rally test scenario
  *   TEST_TARGET                     Salt target for Rally node
+ *   CONTAINER_NAME                  Name of the Docker container which runs Rally
  *   CLEANUP_REPORTS_AND_CONTAINER   Cleanup reports from rally,tempest container, remove all containers started the IMAGE_LINK
  *   DO_CLEANUP_RESOURCES            If "true": runs clean-up script for removing Rally and Tempest resources
  */
@@ -52,7 +53,7 @@
         if (CLEANUP_REPORTS_AND_CONTAINER.toBoolean()) {
             stage('Cleanup reports and container') {
                 test.removeReports(pepperEnv, TEST_TARGET, "rally_reports", 'rally_reports.tar')
-                test.removeDockerContainer(pepperEnv, TEST_TARGET, IMAGE_LINK)
+                test.removeDockerContainer(pepperEnv, TEST_TARGET, CONTAINER_NAME)
             }
         }
     }
diff --git a/test-run-tempest.groovy b/test-run-tempest.groovy
index 0011daa..1f8a09b 100644
--- a/test-run-tempest.groovy
+++ b/test-run-tempest.groovy
@@ -9,7 +9,9 @@
  *   IMAGE_LINK                      Link to docker image with Rally and Tempest
  *   TEST_TEMPEST_PATTERN            If not false, run tests matched to pattern only
  *   TEST_TARGET                     Salt target for tempest node
- *   CLEANUP_REPORTS_AND_CONTAINER   Cleanup reports from rally,tempest container, remove all containers started the IMAGE_LINK
+ *   CLEANUP_REPORTS                 Cleanup reports from rally,tempest container, remove all containers started the IMAGE_LINK
+ *   SET                             Predefined set for tempest tests
+ *   CONCURRENCY                     How many processes to use to run Tempest tests
  *   DO_CLEANUP_RESOURCES            If "true": runs clean-up script for removing Rally and Tempest resources
  */
 
@@ -34,7 +36,8 @@
 
         stage('Run OpenStack Tempest tests') {
             test.runTempestTests(pepperEnv, IMAGE_LINK, TEST_TARGET, TEST_TEMPEST_PATTERN, "/home/rally/rally_reports/",
-                    DO_CLEANUP_RESOURCES)
+                    "/home/rally/keystonercv3", SET, CONCURRENCY, "mcp.conf", "mcp_skip.list", "/root/keystonercv3",
+                    "/root/rally_reports", DO_CLEANUP_RESOURCES)
         }
         stage('Copy test reports') {
             test.copyTempestResults(pepperEnv, TEST_TARGET)
@@ -46,10 +49,9 @@
         currentBuild.result = 'FAILURE'
         throw e
     } finally {
-        if (CLEANUP_REPORTS_AND_CONTAINER.toBoolean()) {
-            stage('Cleanup reports and container') {
+        if (CLEANUP_REPORTS.toBoolean()) {
+            stage('Cleanup reports') {
                 test.removeReports(pepperEnv, TEST_TARGET, "rally_reports", 'rally_reports.tar')
-                test.removeDockerContainer(pepperEnv, TEST_TARGET, IMAGE_LINK)
             }
         }
     }