[Libvir] [PATCH] virsh Range check in Credit Scheduler

Saori Fukuta fukuta.saori at jp.fujitsu.com
Fri Jul 20 08:17:34 UTC 2007


On Wed, 18 Jul 2007 04:16:36 -0400 Daniel Veillard wrote:
> On Wed, Jul 18, 2007 at 09:11:42AM +0900, Atsushi SAKAI wrote:
> > Hi, Daniel
> > 
> >  uint16(weight and cap) is copyied in src/virsh.c
> > so It cannot rewrite on src/xen_internal.c.
> 
>    xenHypervisorSetSchedulerParameters() do get the int values
> in the case XEN_SCHEDULER_CREDIT :
>   op_dom.u.getschedinfo.u.credit.weight = params[i].value.ui;
> and
>   op_dom.u.getschedinfo.u.credit.cap = params[i].value.ui;
> 
>  the ui field is an unsigned long. the test against the value
> 1 to USHRT_MAX can be done there and the case where one have
> a negative value at the virsh level would correspond to an extremely
> large integer in xenHypervisorSetSchedulerParameters() after the
> unsigned cast.
> 
>   See the enclosed patch, please check,

Hi,

The schedinfo command said strange message.
# virsh schedinfo 25 --weight 0
libvir: Xen error : invalid argument in xenHypervisorSetSchedulerParameters: 
Credit scheduler weight parameter (%d) is out of range (1-65535)
                                  ^^^^here
# virsh schedinfo 25 --cap -1
libvir: Xen error : invalid argument in xenHypervisorSetSchedulerParameters: 
Credit scheduler cap parameter (%d) is out of range (0-65535)
                               ^^^^here

I think we do not need to print the specified number, so I removed
"(%d)" from the code to solve this problem. If you want to print the 
specified number, I will remake this patch !

And I found some wrong code when I was checking about error message.
So I fix them, but if I have a misunderstanding of them, please tell me. :-)

 o I guess 10th argument of __virRaiseError should be specified the number
   of the line. But the value, for example which is number of heypercall, 
   is sometimes specified.
   ---
   xen_internal.c-673-    errmsg = __virErrorMsg(error, info);
   xen_internal.c:674:    __virRaiseError(NULL, NULL, NULL, VIR_FROM_XEN, error, VIR_ERR_ERROR,
   xen_internal.c-675-                    errmsg, info, NULL, value, 0, errmsg, info);
   xen_internal.c-676-}

   There is same mistake at xml.c, xmlrpc.c and xend_internal.c, too.

Thanks,
Saori Fukuta
-------------- next part --------------
A non-text attachment was scrubbed...
Name: remove_perD.patch
Type: application/octet-stream
Size: 1279 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070720/4fe715d6/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mod_10th_arg.patch
Type: application/octet-stream
Size: 3333 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070720/4fe715d6/attachment-0003.obj>


More information about the libvir-list mailing list