Deepti B. Kalakeri wrote:
# HG changeset patch
# User Deepti B. Kalakeri<deeptik(a)linux.vnet.ibm.com>
# Date 1261076229 28800
# Node ID c645bc67171f032edfe15e4e2390e201a218423d
# Parent 8f0220b94152171cd71f7a8181a7d8549e9ee064
[TEST] #2 Fixing vsms/08_modifyresource.py
Tested with KVM and current sources on Fedora
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 8f0220b94152 -r c645bc67171f suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py Fri Dec 11 23:05:10 2009 -0200
+++ b/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py Thu Dec 17 10:57:09 2009 -0800
@@ -272,11 +272,11 @@
def virsh_vcpuinfo(server, dom, virt="Xen"):
- cmd = "virsh -c %s vcpuinfo %s 2>/dev/null | grep VCPU | wc -l" \
- % (virt2uri(virt), dom)
+ cmd = "virsh -c %s vcpuinfo %s 2>/dev/null " % (virt2uri(virt), dom)
ret, out = utils.run_remote(server, cmd)
- if out.isdigit():
- return out
+ if ret == 0 :
+ vcpu = out.count("VCPU")
+ return vcpu
Nice! I wouldn't have thought to use count here. This is much cleaner
than what I was thinking of. =)
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin(a)linux.vnet.ibm.com