Reduce stacks snapshot time
- always create ${ENV_NAME}_${stack}_deployed.ini
- make a single 'suspend' before making snapshots and
a single 'revert + timesync'
Change-Id: Iac35cdbf61e1315ba274ac694c3e4ecab55926cf
diff --git a/jobs/pipelines/swarm-deploy-cicd.groovy b/jobs/pipelines/swarm-deploy-cicd.groovy
index b5e1ff7..0183016 100644
--- a/jobs/pipelines/swarm-deploy-cicd.groovy
+++ b/jobs/pipelines/swarm-deploy-cicd.groovy
@@ -56,15 +56,24 @@
for (stack in "${env.STACK_INSTALL}".split(",")) {
stage("Sanity check the deployed component [${stack}]") {
shared.sanity_check_component(stack)
- }
- if (make_snapshot_stages) {
- stage("Make environment snapshot [${stack}_deployed]") {
- shared.devops_snapshot(stack)
- }
+ // If oslo_config INI file ${ENV_NAME}_salt_deployed.ini exists,
+ // then make a copy for the created snapshot to allow the system
+ // tests to revert this snapshot along with the metadata from the INI file.
+ shared.run_cmd("""\
+ if [ -f \$(pwd)/${ENV_NAME}_salt_deployed.ini ]; then
+ cp \$(pwd)/${ENV_NAME}_salt_deployed.ini \$(pwd)/${ENV_NAME}_${stack}_deployed.ini
+ fi
+ """)
}
} // for
+ if (make_snapshot_stages) {
+ stage("Make environment snapshots for [${env.STACK_INSTALL}]") {
+ shared.devops_snapshot(env.STACK_INSTALL)
+ }
+ }
+
} catch (e) {
common.printMsg("Job is failed", "purple")
shared.download_logs("deploy_drivetrain_${ENV_NAME}")
diff --git a/jobs/pipelines/swarm-deploy-platform-without-cicd.groovy b/jobs/pipelines/swarm-deploy-platform-without-cicd.groovy
index 8d3eb22..ae46b22 100644
--- a/jobs/pipelines/swarm-deploy-platform-without-cicd.groovy
+++ b/jobs/pipelines/swarm-deploy-platform-without-cicd.groovy
@@ -54,12 +54,18 @@
for (stack in "${env.STACK_INSTALL}".split(",")) {
stage("Sanity check the deployed component [${stack}]") {
shared.sanity_check_component(stack)
- }
- stage("Make environment snapshot [${stack}_deployed]") {
- shared.devops_snapshot(stack)
+ shared.run_cmd("""\
+ if [ -f \$(pwd)/${ENV_NAME}_salt_deployed.ini ]; then
+ cp \$(pwd)/${ENV_NAME}_salt_deployed.ini \$(pwd)/${ENV_NAME}_${stack}_deployed.ini
+ fi
+ """)
}
} // for
+ stage("Make environment snapshots for [${env.STACK_INSTALL}]") {
+ shared.devops_snapshot(env.STACK_INSTALL)
+ }
+
} catch (e) {
common.printMsg("Job is failed", "purple")
shared.download_logs("deploy_platform_${ENV_NAME}")
diff --git a/jobs/pipelines/swarm-deploy-platform.groovy b/jobs/pipelines/swarm-deploy-platform.groovy
index 061e555..277ed0a 100644
--- a/jobs/pipelines/swarm-deploy-platform.groovy
+++ b/jobs/pipelines/swarm-deploy-platform.groovy
@@ -56,14 +56,24 @@
for (stack in "${env.STACK_INSTALL}".split(",")) {
stage("Sanity check the deployed component [${stack}]") {
shared.sanity_check_component(stack)
- }
- if (make_snapshot_stages) {
- stage("Make environment snapshot [${stack}_deployed]") {
- shared.devops_snapshot(stack)
- }
+
+ // If oslo_config INI file ${ENV_NAME}_salt_deployed.ini exists,
+ // then make a copy for the created snapshot to allow the system
+ // tests to revert this snapshot along with the metadata from the INI file.
+ shared.run_cmd("""\
+ if [ -f \$(pwd)/${ENV_NAME}_salt_deployed.ini ]; then
+ cp \$(pwd)/${ENV_NAME}_salt_deployed.ini \$(pwd)/${ENV_NAME}_${stack}_deployed.ini
+ fi
+ """)
}
} // for
+ if (make_snapshot_stages) {
+ stage("Make environment snapshots for [${env.STACK_INSTALL}]") {
+ shared.devops_snapshot(env.STACK_INSTALL)
+ }
+ }
+
} catch (e) {
common.printMsg("Job is failed", "purple")
shared.download_logs("deploy_platform_${ENV_NAME}")
diff --git a/src/com/mirantis/system_qa/SharedPipeline.groovy b/src/com/mirantis/system_qa/SharedPipeline.groovy
index 8c438fb..ed667b8 100644
--- a/src/com/mirantis/system_qa/SharedPipeline.groovy
+++ b/src/com/mirantis/system_qa/SharedPipeline.groovy
@@ -587,27 +587,28 @@
""", "cyan")
}
-def devops_snapshot(stack) {
- // Make the snapshot with name "${stack}_deployed"
+def devops_snapshot(stacks) {
+ // Make snapshots with names "${stack}_deployed" for each stack
// for all VMs in the environment.
- // If oslo_config INI file ${ENV_NAME}_salt_deployed.ini exists,
- // then make a copy for the created snapshot to allow the system
- // tests to revert this snapshot along with the metadata from the INI file.
+
run_cmd("""\
- set -ex
dos.py suspend ${ENV_NAME}
- dos.py snapshot ${ENV_NAME} ${stack}_deployed
+ """)
+
+ for (stack in "${stacks}".split(",")) {
+ run_cmd("""\
+ dos.py snapshot ${ENV_NAME} ${stack}_deployed
+ """)
+ devops_snapshot_info("${stack}_deployed")
+ }
+
+ run_cmd("""\
dos.py resume ${ENV_NAME}
sleep 20 # Wait for I/O on the host calms down
CFG01_NAME=\$(dos.py show-resources ${ENV_NAME} | grep ^cfg01 | cut -d" " -f1)
dos.py time-sync ${ENV_NAME} --skip-sync \${CFG01_NAME}
-
- if [ -f \$(pwd)/${ENV_NAME}_salt_deployed.ini ]; then
- cp \$(pwd)/${ENV_NAME}_salt_deployed.ini \$(pwd)/${ENV_NAME}_${stack}_deployed.ini
- fi
""")
- devops_snapshot_info("${stack}_deployed")
}
def get_steps_list(steps) {