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

Hi, When I set a number that is bigger than virtual CPU's setting of guest_dom to <vcpu>, No error-messages are shown. I try follow, # virsh vcpupin guest_dom 100 0,1 [no error messages] # echo $? 1 I make the patch to solve this problem. Thanks, Shigeki Sakamoto. Index: virsh.c =================================================================== RCS file: /data/cvs/libvirt/src/virsh.c,v retrieving revision 1.140 diff -u -p -r1.140 virsh.c --- virsh.c 27 Mar 2008 13:43:01 -0000 1.140 +++ virsh.c 4 Apr 2008 05:21:47 -0000 @@ -1747,6 +1747,7 @@ cmdVcpupin(vshControl * ctl, vshCmd * cm } if (vcpu >= info.nrVirtCpu) { + vshError(ctl, FALSE, _("vcpupin: Invalid vCPU number.")); virDomainFree(dom); return FALSE; }

On Fri, Apr 04, 2008 at 06:55:14PM +0900, S.Sakamoto wrote:
Hi,
When I set a number that is bigger than virtual CPU's setting of guest_dom to <vcpu>, No error-messages are shown.
I try follow,
# virsh vcpupin guest_dom 100 0,1 [no error messages] # echo $? 1
I make the patch to solve this problem.
Makes sense, I also changed the previous message which was wrong, applied and commited to CVS, thanks ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

"S.Sakamoto" <fj0588di@aa.jp.fujitsu.com> wrote:
When I set a number that is bigger than virtual CPU's setting of guest_dom to <vcpu>, No error-messages are shown.
I try follow,
# virsh vcpupin guest_dom 100 0,1 [no error messages] # echo $? 1
I make the patch to solve this problem.
Thank you for the report and patch. For an easily-reproducible failure like this, it is simple to include a regression test case addition, so that we're sure never to reintroduce the offending behavior. Adding even trivial tests like this helps increase automated test coverage, too. So here's a new test to match (I'll commit this on Monday): * tests/vcpupin: Add a test for just-fixed bug. FYI, to run just this one test script, I used this command: make -C tests check TESTS=vcpupin diff --git a/tests/vcpupin b/tests/vcpupin index b56c7f2..7b5f86c 100755 --- a/tests/vcpupin +++ b/tests/vcpupin @@ -24,14 +24,23 @@ fi . $srcdir/test-lib.sh fail=0 + +# Invalid syntax. virsh --connect test:///default vcpupin test a 0,1 > out 2>&1 test $? = 1 || fail=1 - cat <<\EOF > exp || fail=1 error: vcpupin: Invalid or missing vCPU number. EOF +compare out exp || fail=1 +# An out-of-range vCPU number deserves a diagnostic, too. +virsh --connect test:///default vcpupin test 100 0,1 > out 2>&1 +test $? = 1 || fail=1 +cat <<\EOF > exp || fail=1 +error: vcpupin: Invalid vCPU number. + +EOF compare out exp || fail=1 (exit $fail); exit $fail -- 1.5.5.rc2.7.g144a
participants (3)
-
Daniel Veillard
-
Jim Meyering
-
S.Sakamoto