[Qa-jenkins-scm] [jenkins.debian.net] 01/08: lvc: name VMs after the job, so snapshots are distinct

Holger Levsen holger at layer-acht.org
Fri Jun 10 09:30:13 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit c8d42bb1b22eee148a6b352530e949e97155f635
Author: Philip Hands <phil at hands.com>
Date:   Mon Jun 6 22:45:09 2016 +0200

    lvc: name VMs after the job, so snapshots are distinct
---
 bin/lvc.sh                                     |  2 +-
 cucumber/features/support/config.rb            |  4 ++--
 cucumber/features/support/helpers/vm_helper.rb | 10 ++++++++--
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/bin/lvc.sh b/bin/lvc.sh
index 80163b0..526d7e9 100755
--- a/bin/lvc.sh
+++ b/bin/lvc.sh
@@ -60,7 +60,7 @@ RESULTS=$WORKSPACE/results
 
 IMAGE=$WORKSPACE/$(basename $URL)
 
-LIBVIRT_DOMAIN_NAME="lvcVM-$EXECUTOR_NUMBER"
+LIBVIRT_DOMAIN_NAME="lvcVM-$JOB_NAME"
 
 rm -rf $RESULTS $WORKSPACE/screenshot{,-thumb}.png
 
diff --git a/cucumber/features/support/config.rb b/cucumber/features/support/config.rb
index c7caa7c..2d13abd 100644
--- a/cucumber/features/support/config.rb
+++ b/cucumber/features/support/config.rb
@@ -66,8 +66,8 @@ PATIENCE = ENV['PATIENCE'] || 1
 
 # Constants that are statically initialized.
 CONFIGURED_KEYSERVER_HOSTNAME = 'hkps.pool.sks-keyservers.net'
-LIBVIRT_DOMAIN_NAME = "lvcVM-" + $executor_number
-LIBVIRT_DOMAIN_UUID = "203552d5-819c-41f3-800e-2c8ef2546%03d" % $executor_number
+LIBVIRT_DOMAIN_NAME = "lvcVM-" + JOB_NAME
+#LIBVIRT_DOMAIN_UUID = "203552d5-819c-41f3-800e-2c8ef2546%03d" % $executor_number
 LIBVIRT_NETWORK_NAME = "DebianToasterNet"
 LIBVIRT_NETWORK_UUID = "f2305af3-2a64-4f16-afe6-b9dbf02a597e"
 MISC_FILES_DIR = "/srv/jenkins/cucumber/features/misc_files"
diff --git a/cucumber/features/support/helpers/vm_helper.rb b/cucumber/features/support/helpers/vm_helper.rb
index ad1493f..3f17213 100644
--- a/cucumber/features/support/helpers/vm_helper.rb
+++ b/cucumber/features/support/helpers/vm_helper.rb
@@ -74,8 +74,14 @@ class VM
     rexml = REXML::Document.new(default_domain_xml)
     rexml.elements['domain'].add_element('name')
     rexml.elements['domain/name'].text = @domain_name
-    rexml.elements['domain'].add_element('uuid')
-    rexml.elements['domain/uuid'].text = LIBVIRT_DOMAIN_UUID
+    # PGH
+    begin
+      old_domain = @virt.lookup_domain_by_name(LIBVIRT_DOMAIN_NAME)
+      rexml.elements['domain'].add_element('uuid')
+      rexml.elements['domain/uuid'].text = old_domain.uuid
+      old_domain.undefine
+    rescue
+    end
     update(rexml.to_s)
     @display = Display.new(@domain_name, x_display)
     set_cdrom_boot(TAILS_ISO)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list