at 5/25/2012 9:35 PM, Chris Evich wrote:
> On 05/24/2012 10:41 PM, guyanhua wrote:
>>
>> Add virsh nodeinfo function to libvirt_vm.
>>
>> Signed-off-by: Gu Yanhua<[email protected]>
>> ---
>> client/virt/libvirt_vm.py | 11 +++++++++++
>> 1 files changed, 11 insertions(+), 0 deletions(-)
>> mode change 100644 => 100755 client/virt/libvirt_vm.py
>>
>> diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
>> old mode 100644
>> new mode 100755
>> index eda5e8e..2e12d84
>> --- a/client/virt/libvirt_vm.py
>> +++ b/client/virt/libvirt_vm.py
>> @@ -85,6 +85,17 @@ def service_libvirtd_control(action):
>> else:
>> raise error.TestError("Unknown action: %s" % action)
>>
>
> It would be nice if virsh_nodeinfo() accepted a keyword uri="" option
> like the other virsh_*() functions. This would make it more generally
> useful if ever we want to test remote libvirt also.
Thanks for your suggestion, I will follow it.
>
>> +def virsh_nodeinfo(option):
>> + """
>> + Returns basic information about the node
>> + """
>> + cmd = "virsh nodeinfo %s" % option
>> + cmd_result = utils.run(cmd, ignore_status=True)
>
> Here, I think you can re-use the virsh_cmd() function instead of
> utils.run(), no?
Here,I think we can not re-use the virsh_cmd() function instead of utils.run().
First, in virsh_cmd() function, it uses the default param(ignore_status=False)
of utils.run(),
it means that if we give a wrong param of command, it will get a
status(!=0) , raise error
and interrupt the test. Contrary, our aim is to test whether the
command is right.
when it gets a wrong param of command, the status shouldn't be equal to
zero, which we hope.
And we also hope it keeps running normally.
Second, in virsh_cmd() function, it only returns the output of the command, no
exit status. But in
our tests we will use the status for further check.
>
>> + logging.info("Output: %s", cmd_result.stdout.strip())
>> + logging.error("Error: %s", cmd_result.stderr.strip())
>> + logging.info("Status: %d", cmd_result.exit_status)
>> + return cmd_result.exit_status, cmd_result.stdout.strip()
>> +
>>
>> def virsh_cmd(cmd, uri = ""):
>> """
>> --
>> 1.7.1
>>
>> _______________________________________________
>> Autotest mailing list
>> [email protected]
>> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
>
>
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest