Failing test:
HostSystem - 03_hs_to_settdefcap.py: FAIL
ERROR   - Failed to get associatornames according to KVM_AllocationCapabilities
ERROR   - Exception: list index out of range

Investigation discovered that 'enum_volumes()' was not properly handling
the case where there were no volumes in 'DiskPool/default'.

Also function cannot return 'None' as caller 'get_exp_disk_rasd_len' assumed
integer return value and attempted a multiplication resulting in an exception.
---
 suites/libvirt-cim/lib/XenKvmLib/pool.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/suites/libvirt-cim/lib/XenKvmLib/pool.py 
b/suites/libvirt-cim/lib/XenKvmLib/pool.py
index 1a57aba..ddbe532 100644
--- a/suites/libvirt-cim/lib/XenKvmLib/pool.py
+++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py
@@ -110,8 +110,8 @@ def enum_volumes(virt, server, pooln=default_pool_name):
     cmd = 'virsh -c %s vol-list %s 2>/dev/null | sed -e "1,2 d" -e "$ d"' % \
           (virt2uri(virt), pooln)
     ret, out = run_remote(server ,cmd)
-    if ret != 0:
-        return None
+    if ret != 0 or len(out) == 0:
+        return volume
     lines = out.split("\n")
     for line in lines:
         vol = line.split()[0]   
-- 
1.8.1.4

_______________________________________________
Libvirt-cim mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvirt-cim

Reply via email to