[Libvirt-cim] [PATCH] [TEST] Fixing vsms/08_modifyresource.py
Kaitlin Rupert
kaitlin at linux.vnet.ibm.com
Tue Dec 15 23:53:11 UTC 2009
>>>>> 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
>>
>> Agreed. I think that's a flaw of the virsh_vcpuinfo() call though.
>> Because you never know whether "virsh -c %s vcpuinfo %s" fails. I
>> would remove the "| grep VCPU | wc -l" portion of the command. Check
>> to see if the call fails - if it does, return None from
>> virsh_vcpuinfo(). If the call doesn't fall, parse the output to get
>> the VCPU count.
>>
> Yes! This is what I was thinking of, but was as you said this will take
> little more code than the one line which did the work for us.
>> Thoughts? This is a lot more work, but then you would know when the
>> virsh call is failing (as opposed to just returning 0 VCPus).
> I will work on this and send the patch.
Sounds great. Thanks!
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com
More information about the Libvirt-cim
mailing list