From: Ian Main <[email protected]>

This patch makes finding of volumes within attached pools more rubust
by looking for the filename if it fails to find it by key.  This
fixes the volume finding for cobbler iso images mounted on nfs.

Signed-off-by: Ian Main <[email protected]>
---
 src/task-omatic/taskomatic.rb |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/task-omatic/taskomatic.rb b/src/task-omatic/taskomatic.rb
index 96b2ec4..ece60dc 100755
--- a/src/task-omatic/taskomatic.rb
+++ b/src/task-omatic/taskomatic.rb
@@ -223,7 +223,13 @@ class TaskOmatic
       volume = @session.object(:class => 'volume',
                                'key' => volume_key,
                                'storagePool' => pool.object_id)
-      raise "Unable to find volume #{volume_key} attached to pool 
#{pool.name}." unless volume
+      if volume == nil
+        @logger.info "Unable to find volume by key #{volume_key} attached to 
pool #{pool.name}, trying by filename..."
+        volume = @session.object(:class => 'volume',
+                                 'name' => db_volume.filename,
+                                 'storagePool' => pool.object_id)
+       raise "Unable to find volume by key (#{volume_key}) or filename 
(#{db_volume.filename}), giving up." unless volume
+      end
       @logger.debug "Verified volume of pool #{volume.path}"
 
       storagedevs << volume.path
-- 
1.6.2.5

_______________________________________________
Ovirt-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/ovirt-devel

Reply via email to