Dude, I'm pretty sure I've already commited this one

commit fdc5e422ada139afd3502e9cac56f2d15f4be85c
Author: Gu Yanhua <guyanhua-f...@cn.fujitsu.com>
Date:   Sun Jun 10 23:19:59 2012 -0300

    virt.libvirt_vm: Modify the virsh_cmd function and relevant callers

    Modify the virsh_cmd function by adding a param ignore_status with
    False default and returning cmd_result dirctly. Accordingly, change
    the virsh_cmd callers' return value.

    Signed-off-by: Gu Yanhua <guyanhua-f...@cn.fujitsu.com>

You'll have to prepare a separate patch adding virsh_nodeinfo and
resend the patches.

On Wed, Jun 13, 2012 at 11:54 PM, guyanhua <guyanhua-f...@cn.fujitsu.com> wrote:
>
> Modify the virsh_cmd function by adding a param ignore_status with False 
> default
> and returning cmd_result dirctly. Accordingly changing the virsh_cmd callers'
> return value. Besides that, adding virsh_nodeinfo function in libvirt_vm.py.
>
> Signed-off-by: Gu Yanhua <guyanhua-f...@cn.fujitsu.com>
> ---
>  client/virt/libvirt_vm.py |   29 ++++++++++++++++++-----------
>  1 files changed, 18 insertions(+), 11 deletions(-)
>
> diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
> index cbed8aa..71fa3b9 100644
> --- a/client/virt/libvirt_vm.py
> +++ b/client/virt/libvirt_vm.py
> @@ -86,7 +86,7 @@ def service_libvirtd_control(action):
>          raise error.TestError("Unknown action: %s" % action)
>
>
> -def virsh_cmd(cmd, uri = ""):
> +def virsh_cmd(cmd, uri = "", ignore_status=False):
>      """
>      Append cmd to 'virsh' and execute, optionally return full results.
>
> @@ -101,29 +101,36 @@ def virsh_cmd(cmd, uri = ""):
>      if uri:
>          uri_arg = "-c " + uri
>      cmd = "%s %s %s" % (VIRSH_EXEC, uri_arg, cmd)
> -    cmd_result = utils.run(cmd, verbose=DEBUG)
> -    return cmd_result.stdout.strip()
> +    cmd_result = utils.run(cmd, verbose=DEBUG, ignore_status=ignore_status)
> +    return cmd_result
>
> +def virsh_nodeinfo(uri = "", ignore_status=False, extra = ""):
> +    """
> +    Returns basic information about the node,like number and type of CPU,
> +    and size of the physical memory.
> +    """
> +    cmd_nodeinfo = "nodeinfo %s" % extra
> +    return virsh_cmd(cmd_nodeinfo, uri, ignore_status)
>
>  def virsh_uri(uri = ""):
>      """
>      Return the hypervisor canonical URI.
>      """
> -    return virsh_cmd("uri", uri)
> +    return virsh_cmd("uri", uri).stdout.strip()
>
>
>  def virsh_hostname(uri = ""):
>      """
>      Return the hypervisor hostname.
>      """
> -    return virsh_cmd("hostname", uri)
> +    return virsh_cmd("hostname", uri).stdout.strip()
>
>
>  def virsh_version(uri = ""):
>      """
>      Return the major version info about what this built from.
>      """
> -    return virsh_cmd("version", uri)
> +    return virsh_cmd("version", uri).stdout.strip()
>
>
>  def virsh_driver(uri = ""):
> @@ -143,21 +150,21 @@ def virsh_domstate(name, uri = ""):
>
>      @param name: VM name
>      """
> -    return virsh_cmd("domstate %s" % name, uri)
> +    return virsh_cmd("domstate %s" % name, uri).stdout.strip()
>
>
>  def virsh_domid(name, uri = ""):
>      """
>      Return VM's ID.
>      """
> -    return virsh_cmd("domid %s" % (name), uri)
> +    return virsh_cmd("domid %s" % (name), uri).stdout.strip()
>
>
>  def virsh_dominfo(name, uri = ""):
>      """
>      Return the VM information.
>      """
> -    return virsh_cmd("dominfo %s" % (name), uri)
> +    return virsh_cmd("dominfo %s" % (name), uri).stdout.strip()
>
>
>  def virsh_uuid(name, uri = ""):
> @@ -166,7 +173,7 @@ def virsh_uuid(name, uri = ""):
>
>      @param name: VM name
>      """
> -    return virsh_cmd("domuuid %s" % name, uri)
> +    return virsh_cmd("domuuid %s" % name, uri).stdout.strip()
>
>
>  def virsh_screenshot(name, filename, uri = ""):
> @@ -185,7 +192,7 @@ def virsh_dumpxml(name, uri = ""):
>
>      @param name: VM name
>      """
> -    return virsh_cmd("dumpxml %s" % name, uri)
> +    return virsh_cmd("dumpxml %s" % name, uri).stdout.strip()
>
>
>  def virsh_is_alive(name, uri = ""):
> --
> 1.7.1
>
> _______________________________________________
> Autotest mailing list
> Autotest@test.kernel.org
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest



-- 
Lucas
_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to