[Libvir] [PATCH] add error message for the case of the vcpupin command fails.

Hi, I try follow, # virsh vcpupin guest_dom AAA 0,1 [no error messages] # echo $? 1 There is no processing to output an error-message, when vshCommandOptInt become an error. I make the patch to solve this problem. Thanks, Shigeki Sakamoto. Index: src/virsh.c =================================================================== RCS file: /data/cvs/libvirt/src/virsh.c,v retrieving revision 1.134 diff -u -p -r1.134 virsh.c --- src/virsh.c 27 Feb 2008 16:14:44 -0000 1.134 +++ src/virsh.c 4 Mar 2008 08:35:47 -0000 @@ -1723,6 +1723,8 @@ cmdVcpupin(vshControl * ctl, vshCmd * cm vcpu = vshCommandOptInt(cmd, "vcpu", &vcpufound); if (!vcpufound) { + vshCmdOpt *arg = vshCommandOpt(cmd, "vcpu"); + vshError(ctl, FALSE, _("vcpu: %s: Invalid virtual CPU number."), arg->data); virDomainFree(dom); return FALSE; }

On Tue, Mar 04, 2008 at 06:30:46PM +0900, S.Sakamoto wrote:
Hi,
I try follow,
# virsh vcpupin guest_dom AAA 0,1 [no error messages] # echo $? 1
There is no processing to output an error-message, when vshCommandOptInt become an error.
I make the patch to solve this problem.
+1. I'll apply it in a moment. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top

OK, I'm going to qualify that a bit. Is it always safe to access arg->data? I think probably it is, but I'm not sure so I modified the patch slightly just to print an error message like this: $ src/virsh -c test:///default vcpupin test AAA 0,1 error: vcpupin: Invalid or missing vCPU number. Rich. PS. Please try to attach your patches instead of pasting them inline. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top

On Tue, Mar 04, 2008 at 11:03:25AM +0000, Richard W.M. Jones wrote:
OK, I'm going to qualify that a bit. Is it always safe to access arg->data? I think probably it is, but I'm not sure so I modified the patch slightly just to print an error message like this:
$ src/virsh -c test:///default vcpupin test AAA 0,1 error: vcpupin: Invalid or missing vCPU number.
I committed this version. Let me know if it's OK. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v

On Tue, Mar 04, 2008 at 11:03:25AM +0000, Richard W.M. Jones wrote:
OK, I'm going to qualify that a bit. Is it always safe to access arg->data? I think probably it is, but I'm not sure so I modified the patch slightly just to print an error message like this:
$ src/virsh -c test:///default vcpupin test AAA 0,1 error: vcpupin: Invalid or missing vCPU number.
I committed this version. Let me know if it's OK.
I'm OK. I try this version. It works fine. Thanks, Shigeki Sakamoto.
participants (2)
-
Richard W.M. Jones
-
S.Sakamoto