Merge lp:~heber013/qa-jenkins-jobs/delete-vm-properly into lp:qa-jenkins-jobs

Proposed by Heber Parrucci
Status: Merged
Approved by: Jean-Baptiste Lallement
Approved revision: 288
Merged at revision: 286
Proposed branch: lp:~heber013/qa-jenkins-jobs/delete-vm-properly
Merge into: lp:qa-jenkins-jobs
Diff against target: 45 lines (+12/-2)
2 files modified
jobs/ubuntu-system-tests/ubuntu-system-tests-run-tests-builder.sh (+6/-1)
scripts/iso-testing/run-iso-test.sh (+6/-1)
To merge this branch: bzr merge lp:~heber013/qa-jenkins-jobs/delete-vm-properly
Reviewer Review Type Date Requested Status
Jean-Baptiste Lallement Approve
platform-qa-bot continuous-integration Approve
Review via email: mp+329516@code.launchpad.net

Commit message

Properly deleting VM for ISO tests: destroy && undefine

Description of the change

Properly deleting VM for ISO tests: destroy && undefine

To post a comment you must log in.
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
287. By Heber Parrucci

Delete img file if destroy or undefine fails

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
288. By Heber Parrucci

parametrize delete_vm function

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

LGTM. Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'jobs/ubuntu-system-tests/ubuntu-system-tests-run-tests-builder.sh'
2--- jobs/ubuntu-system-tests/ubuntu-system-tests-run-tests-builder.sh 2017-07-19 20:01:46 +0000
3+++ jobs/ubuntu-system-tests/ubuntu-system-tests-run-tests-builder.sh 2017-08-24 14:24:27 +0000
4@@ -12,10 +12,15 @@
5 echo "I: Cleaning disk image file"
6 if [ "$CLEAN_DISK_IMG_AFTER_RUN" == "true" ]; then
7 echo "I: Cleaning disk image file"
8- [ -f "$SHARED_IMG_PATH" ] && sudo rm -f "$SHARED_IMG_PATH"
9+ [ -f "$SHARED_IMG_PATH" ] && delete_vm $(basename "$SHARED_IMG_PATH") || sudo rm -f "$SHARED_IMG_PATH"
10 fi
11 }
12
13+delete_vm() {
14+ # $1: machine name to delete
15+ sudo virsh destroy $1 && sudo virsh undefine $1
16+}
17+
18 trap on_exit EXIT INT QUIT ABRT PIPE TERM
19
20 rm -rf $OUTPUTDIR
21
22=== modified file 'scripts/iso-testing/run-iso-test.sh'
23--- scripts/iso-testing/run-iso-test.sh 2017-08-08 17:13:36 +0000
24+++ scripts/iso-testing/run-iso-test.sh 2017-08-24 14:24:27 +0000
25@@ -7,7 +7,7 @@
26 on_exit() {
27 # Exit Handler
28 if [ -z ${RETCODE} ] || [ ${RETCODE} != 0 ]; then
29- [ ! -z "$machine_name" ] && [ -d "$SHARED_IMG_PATH"/"$machine_name" ] && sudo rm -rf "$SHARED_IMG_PATH"/"$machine_name"
30+ [ ! -z "$machine_name" ] && [ -d "$SHARED_IMG_PATH"/"$machine_name" ] && delete_vm $machine_name
31 exit "${RETCODE:=1}"
32 else
33 echo SUCCESS!!!!
34@@ -15,6 +15,11 @@
35 fi
36 }
37
38+delete_vm() {
39+ # $1: machine name to delete
40+ sudo virsh destroy $1 && sudo virsh undefine $1
41+}
42+
43 trap on_exit EXIT INT QUIT ABRT PIPE TERM
44
45 usage() {

Subscribers

People subscribed via source and target branches

to all changes: