summaryrefslogtreecommitdiffstats
path: root/features/support/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'features/support/helpers')
-rw-r--r--features/support/helpers/storage_helper.rb18
1 files changed, 11 insertions, 7 deletions
diff --git a/features/support/helpers/storage_helper.rb b/features/support/helpers/storage_helper.rb
index 9a32db5..65e007b 100644
--- a/features/support/helpers/storage_helper.rb
+++ b/features/support/helpers/storage_helper.rb
@@ -18,18 +18,22 @@ class VMStorage
@xml_path = xml_path
pool_xml = REXML::Document.new(File.read("#{@xml_path}/storage_pool.xml"))
pool_name = pool_xml.elements['pool/name'].text
+ @pool_path = "#{$config["TMPDIR"]}/#{pool_name}"
begin
@pool = @virt.lookup_storage_pool_by_name(pool_name)
rescue Libvirt::RetrieveError
- # There's no pool with that name, so we don't have to clear it
- else
+ @pool = nil
+ end
+ if @pool and not(KEEP_SNAPSHOTS)
VMStorage.clear_storage_pool(@pool)
+ @pool = nil
end
- @pool_path = "#{$config["TMPDIR"]}/#{pool_name}"
- pool_xml.elements['pool/target/path'].text = @pool_path
- @pool = @virt.define_storage_pool_xml(pool_xml.to_s)
- @pool.build unless Dir.exists?(@pool_path)
- @pool.create
+ unless @pool
+ pool_xml.elements['pool/target/path'].text = @pool_path
+ @pool = @virt.define_storage_pool_xml(pool_xml.to_s)
+ @pool.build unless Dir.exists?(@pool_path)
+ end
+ @pool.create unless @pool.active?
@pool.refresh
end