
Kaitlin Rupert wrote:
Deepti B. Kalakeri wrote:
# HG changeset patch # User Deepti B. Kalakeri<deeptik@linux.vnet.ibm.com # Date 1260446374 28800 # Node ID e95a3d156fc2284484f98f07c39fbfd65929a395 # Parent 683a8a57d54506032a659bdb9178b7558827ffde [TEST] Fixing vsms/08_modifyresource.py
Tested with KVM and current sources on Fedora Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com>
diff -r 683a8a57d545 -r e95a3d156fc2 suites/libvirt-cim/lib/XenKvmLib/vsms_util.py --- a/suites/libvirt-cim/lib/XenKvmLib/vsms_util.py Sat Dec 05 02:22:09 2009 -0200 +++ b/suites/libvirt-cim/lib/XenKvmLib/vsms_util.py Thu Dec 10 03:59:34 2009 -0800 @@ -120,9 +120,10 @@ cxml.dumpxml(server) dom = cxml.xml_get_dom_name() cpu = virsh_vcpuinfo(server, dom, virt) - if cpu is None: + if int(cpu) < int(ncpu) or cpu is None:
This works, but it's more of a work around. In this case, vcpuinfo returns an error. When we check the output for the VCPU string, we get zero occurrences, which is what virsh_vcpuinfo() returns.
A better check would be to see if the virsh call returns an error. If it does, virsh_vcpuinfo() should return None. Otherwise, it should return an integer. virsh_vcpuinfo() uses the following command cmd = "virsh -c %s vcpuinfo %s 2>/dev/null | grep VCPU | wc -l" % (virt2uri(virt), dom) which would return success even when no records are found. So I think a better way would be to verify the value returned and return the out when command returns something >0, otherwise None.
Any suggestions ?
logger.info("Unable to get vcpuinfo from virsh, using XML values") cpu = cxml.xml_get_vcpu() + if int(cpu) != int(ncpu): logger.error("Got %d, exp %d.", int(cpu), int(ncpu)) raise Exception('Error changing rs for vcpu')
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
-- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik@linux.vnet.ibm.com