All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libvirt_vm.py:  Set ignore_status to False in virsh_cmd().
@ 2012-01-11  7:06 tangchen
  2012-01-12 15:53 ` Lucas Meneghel Rodrigues
  0 siblings, 1 reply; 2+ messages in thread
From: tangchen @ 2012-01-11  7:06 UTC (permalink / raw)
  To: Lucas Meneghel Rodrigues, autotest, kvm

utils.run()'s parameter "ignore_status" is set to "True" in virsh_cmd(). 
In this case we are not able to know whether the command succeeds. 
This patch sets it to "False", and utils.run() will throw an exception 
when command fails.


Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
---
 client/virt/libvirt_vm.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
index c825661..6f30f36 100644
--- a/client/virt/libvirt_vm.py
+++ b/client/virt/libvirt_vm.py
@@ -38,7 +38,7 @@ def virsh_cmd(cmd, uri = ""):
     if uri:
         uri_arg = "-c " + uri
 
-    cmd_result = utils.run("%s %s %s" % (VIRSH_EXEC, uri_arg, cmd), ignore_status=True,
+    cmd_result = utils.run("%s %s %s" % (VIRSH_EXEC, uri_arg, cmd), ignore_status=False,
                            verbose=DEBUG)
     if DEBUG:
         if cmd_result.stdout.strip():
-- 
1.7.3.1


-- 
Best Regards,
Tang chen
--------------------------------------------------
Tang Chen
Development Dept.I
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
No.6 Wenzhu Road, Nanjing, 210012, China 
TEL: +86+25-86630566-8527
FUJITSU INTERNAL: 7998-8527
FAX: +86+25-83317685
EMail: tangchen@cn.fujitsu.com
--------------------------------------------------
This communication is for use by the intended recipient(s) only and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not an intended recipient of this communication, you are hereby notified that any dissemination, distribution or copying hereof is strictly prohibited.  If you have received this communication in error, please notify me by reply e-mail, permanently delete this communication from your system, and destroy any hard copies you may have printed


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libvirt_vm.py: Set ignore_status to False in virsh_cmd().
  2012-01-11  7:06 [PATCH] libvirt_vm.py: Set ignore_status to False in virsh_cmd() tangchen
@ 2012-01-12 15:53 ` Lucas Meneghel Rodrigues
  0 siblings, 0 replies; 2+ messages in thread
From: Lucas Meneghel Rodrigues @ 2012-01-12 15:53 UTC (permalink / raw)
  To: tangchen; +Cc: autotest, kvm

On 01/11/2012 05:06 AM, tangchen wrote:
> utils.run()'s parameter "ignore_status" is set to "True" in virsh_cmd().
> In this case we are not able to know whether the command succeeds.
> This patch sets it to "False", and utils.run() will throw an exception
> when command fails.

Problem with this is that some commands may fail and that is not a fatal 
problem, for example:

13:49:26 ERROR| Test failed: CmdError: Command </usr/bin/virsh -c 
qemu:///system domstate vm1> failed, rc=1, Command returned non-zero 
exit status    [context: preprocessing]
* Command:
     /usr/bin/virsh -c qemu:///system domstate vm1
Exit status: 1
Duration: 0.0250420570374

stderr:
error: failed to get domain 'vm1'
error: Domain not found: no domain with matching name 'vm1'

This is just a function to probe whether the domain exists or not, so it 
shouldn't throw an exception. I agree we can do better handling of 
failures, but a more thorough patch handling failures on the functions 
dependent on virsh_cmd is needed.

So I'm rejecting the patch. Feel free to open an issue contemplating 
this perceived problem, and we can work towards a more appropriate patch.

>
> Signed-off-by: Tang Chen<tangchen@cn.fujitsu.com>
> ---
>   client/virt/libvirt_vm.py |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
> index c825661..6f30f36 100644
> --- a/client/virt/libvirt_vm.py
> +++ b/client/virt/libvirt_vm.py
> @@ -38,7 +38,7 @@ def virsh_cmd(cmd, uri = ""):
>       if uri:
>           uri_arg = "-c " + uri
>
> -    cmd_result = utils.run("%s %s %s" % (VIRSH_EXEC, uri_arg, cmd), ignore_status=True,
> +    cmd_result = utils.run("%s %s %s" % (VIRSH_EXEC, uri_arg, cmd), ignore_status=False,
>                              verbose=DEBUG)
>       if DEBUG:
>           if cmd_result.stdout.strip():

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-12 15:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-11  7:06 [PATCH] libvirt_vm.py: Set ignore_status to False in virsh_cmd() tangchen
2012-01-12 15:53 ` Lucas Meneghel Rodrigues

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.