[Qa-jenkins-scm] [jenkins.debian.net] 01/01: lvc: make sure that the pool directory exists, independent of the pool

Holger Levsen holger at layer-acht.org
Mon Jul 11 19:25:49 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 55dde865bdfda0d7c69f9467c6d084f24a152cbb
Author: Philip Hands <phil at hands.com>
Date:   Mon Jul 11 21:01:50 2016 +0200

    lvc: make sure that the pool directory exists, independent of the pool
    
    on pb10 it seems that it's currently failing to do this, so perhaps
    the pool is being left around despite the directory not existing.
    This may allow the pool to start working, or may act to highlight
    the underlying problem.
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 .../features/support/helpers/storage_helper.rb     | 24 +++++++++++-----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/cucumber/features/support/helpers/storage_helper.rb b/cucumber/features/support/helpers/storage_helper.rb
index 2040937..b8c7950 100644
--- a/cucumber/features/support/helpers/storage_helper.rb
+++ b/cucumber/features/support/helpers/storage_helper.rb
@@ -19,7 +19,7 @@ class VMStorage
     pool_xml = REXML::Document.new(File.read("#{@xml_path}/storage_pool.xml"))
     pool_name = LIBVIRT_DOMAIN_NAME
     pool_xml.elements['pool/name'].text = pool_name
-    @pool_path = "/srv/workspace/vm-pools/#{pool_name}"
+    @pool_path = "/srv/workspace/vm-pools/#{pool_name}"  # FIXME -- hardwiring the .../vm-pools path semms like a poor effort
     begin
       @pool = @virt.lookup_storage_pool_by_name(pool_name)
     rescue Libvirt::RetrieveError
@@ -29,20 +29,20 @@ class VMStorage
       VMStorage.clear_storage_pool(@pool)
       @pool = nil
     end
+    if not(Dir.exists?(@pool_path))
+      # We'd like to use @pool.build, which will just create the
+      # @pool_path directory, but it does so with root:root as owner
+      # (at least with libvirt 1.2.21-2). libvirt itself can handle
+      # that situation, but guestfs (at least with <=
+      # 1:1.28.12-1+b3) cannot when invoked by a non-root user,
+      # which we want to support.
+      FileUtils.mkdir(@pool_path)
+      FileUtils.chown(nil, 'libvirt-qemu', @pool_path)
+      FileUtils.chmod("ug+wrx", @pool_path)
+    end
     unless @pool
       pool_xml.elements['pool/target/path'].text = @pool_path
       @pool = @virt.define_storage_pool_xml(pool_xml.to_s)
-      if not(Dir.exists?(@pool_path))
-        # We'd like to use @pool.build, which will just create the
-        # @pool_path directory, but it does so with root:root as owner
-        # (at least with libvirt 1.2.21-2). libvirt itself can handle
-        # that situation, but guestfs (at least with <=
-        # 1:1.28.12-1+b3) cannot when invoked by a non-root user,
-        # which we want to support.
-        FileUtils.mkdir(@pool_path)
-        FileUtils.chown(nil, 'libvirt-qemu', @pool_path)
-        FileUtils.chmod("ug+wrx", @pool_path)
-      end
     end
     @pool.create unless @pool.active?
     @pool.refresh

-- 
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