Ian Main
2009-Sep-24 22:16 UTC
[Ovirt-devel] [PATCH server] Make volume finding more robust.
From: Ian Main <imain at management.mains.priv>
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 <imain at redhat.com>
---
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
