diff options
author | Philip Hands <phil@hands.com> | 2016-07-11 21:01:50 +0200 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2016-07-11 21:25:33 +0200 |
commit | 55dde865bdfda0d7c69f9467c6d084f24a152cbb (patch) | |
tree | 391e0fdfcccf5eaf3b5e89b9ac109e0c88261950 /cucumber/features/support/helpers | |
parent | ab4f64f4e9a999dade64e57959a61f02885e2b39 (diff) | |
download | jenkins.debian.net-55dde865bdfda0d7c69f9467c6d084f24a152cbb.tar.xz |
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@layer-acht.org>
Diffstat (limited to 'cucumber/features/support/helpers')
-rw-r--r-- | cucumber/features/support/helpers/storage_helper.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/cucumber/features/support/helpers/storage_helper.rb b/cucumber/features/support/helpers/storage_helper.rb index 2040937b..b8c79501 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 |