Thanks, nicely done. I applied it to next branch for testing. On 06/26/2012 11:18 PM, tangchen wrote: > Signed-off-by: Tang Chen<tangc...@cn.fujitsu.com> > > This patch introduces a new parameter print_info with default > value False to support logging output control. > --- > client/virt/libvirt_vm.py | 20 +++++++++++++++++--- > 1 files changed, 17 insertions(+), 3 deletions(-) > > diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py > index d97ac0c..009a643 100644 > --- a/client/virt/libvirt_vm.py > +++ b/client/virt/libvirt_vm.py > @@ -86,12 +86,14 @@ def service_libvirtd_control(action): > raise error.TestError("Unknown action: %s" % action) > > > -def virsh_cmd(cmd, uri="", ignore_status=False): > +def virsh_cmd(cmd, uri="", ignore_status=False, print_info=False): > """ > Append cmd to 'virsh' and execute, optionally return full results. > > @param: cmd: Command line to append to virsh command > - @param: uri: hypervisor URI to connect to > + @param: uri: Hypervisor URI to connect to > + @param: ignore_status: Raise an exception if False > + @param: print_info: Print stdout and stderr if True > @return: CmdResult object > """ > if VIRSH_EXEC is None: > @@ -101,7 +103,18 @@ def virsh_cmd(cmd, uri="", ignore_status=False): > if uri: > uri_arg = "-c " + uri > cmd = "%s %s %s" % (VIRSH_EXEC, uri_arg, cmd) > - return utils.run(cmd, verbose=DEBUG, ignore_status=ignore_status) > + > + if print_info: > + logging.debug("Running command: %s" % cmd) > + > + ret = utils.run(cmd, verbose=DEBUG, ignore_status=ignore_status) > + > + if print_info: > + logging.debug("status: %s" % ret.exit_status) > + logging.debug("stdout: %s" % ret.stdout.strip()) > + logging.debug("stderr: %s" % ret.stderr.strip()) > + return ret > + > > def virsh_nodeinfo(uri = "", ignore_status=False, extra = ""): > """ > @@ -111,6 +124,7 @@ def virsh_nodeinfo(uri = "", ignore_status=False, extra = > ""): > cmd_nodeinfo = "nodeinfo %s" % extra > return virsh_cmd(cmd_nodeinfo, uri, ignore_status) > > + > def virsh_uri(uri=""): > """ > Return the hypervisor canonical URI.
-- Chris Evich, RHCA, RHCE, RHCDS, RHCSS Quality Assurance Engineer e-mail: cevich + `@' + redhat.com o: 1-888-RED-HAT1 x44214 _______________________________________________ Autotest mailing list Autotest@test.kernel.org http://test.kernel.org/cgi-bin/mailman/listinfo/autotest