# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1210684047 25200
# Node ID f81fd5f73b3e71630bf2b6e6e6a51a8f7f254346
# Parent cdcf642c493a548d2deb499f223bb9a1f414cb3c
[TEST] Adding virsh_version() and diskpool_list() to live.py.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r cdcf642c493a -r f81fd5f73b3e lib/VirtLib/live.py
--- a/lib/VirtLib/live.py Mon May 12 03:23:12 2008 -0700
+++ b/lib/VirtLib/live.py Tue May 13 06:07:27 2008 -0700
@@ -313,3 +313,28 @@ def network_by_bridge(bridge, server, vi
return network
return None
+
+def virsh_version(server, virt="KVM"):
+ cmd = "virsh -c %s -v " % utils.virt2uri(virt)
+ ret, out = utils.run_remote(server, cmd)
+ if ret != 0:
+ return None
+ return out
+
+def diskpool_list(server, virt="KVM"):
+ """Function to list active DiskPool list"""
+ names = []
+ cmd = "virsh -c %s pool-list | sed -e '1,2 d' -e '$ d'" %
\
+ utils.virt2uri(virt)
+ ret, out = utils.run_remote(server, cmd)
+
+ if ret != 0:
+ return names
+
+ lines = out.split("\n")
+ for line in lines:
+ disk_pool = line.split()
+ if len(disk_pool) >= 1 and disk_pool[1] == "active":
+ names.append(disk_pool[0])
+
+ return names