WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] [RESEND] Fix xm commands so that the Traceback does

To: Ewan Mellor <ewan@xxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] [RESEND] Fix xm commands so that the Traceback does not occur
From: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
Date: Thu, 15 Jun 2006 19:41:39 +0900
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 15 Jun 2006 03:42:30 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20060614143545.GC6955@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <F1C68F5C39DF69kanno.masaki@xxxxxxxxxxxxxx> <20060614143545.GC6955@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi,

We reflected comment to our patch. Our patch has become very small. :-)


Signed-off-by: Hiroyuki Yamamoto <yamamoto.hiroyu@xxxxxxxxxxxxxx>
Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>

Best regards,
 Kan

>On Wed, Jun 14, 2006 at 11:42:49AM +0900, Masaki Kanno wrote:
>
>Content-Description: Mail message body
>> Hi,
>> 
>> When we tested xm commands, the xm commands occurred the Traceback.
>> The following are the examples.
>> 
>> # xm sched-sedf domUtemp -s xx
>> Unexpected error: exceptions.ValueError
>> 
>> Please report to xen-devel@xxxxxxxxxxxxxxxxxxx
>> Traceback (most recent call last):
>>   File "/usr/sbin/xm", line 10, in ?
>>     main.main(sys.argv)
>>   File "//usr/lib/python/xen/xm/main.py", line 1169, in main
>>     rc = cmd(args)
>>   File "//usr/lib/python/xen/xm/main.py", line 701, in xm_sched_sedf
>>     opts['slice'] = ms_to_ns(v)
>>   File "//usr/lib/python/xen/xm/main.py", line 665, in ms_to_ns
>>     return (float(val) / 0.000001)
>> ValueError: invalid literal for float(): xx
>
>> [Snip]
>
>> The cause of the Traceback are entering wrong xm commands.
>> We suggest this patch so that the Traceback does not occur.
>> 
>> Signed-off-by: Hiroyuki Yamamoto <yamamoto.hiroyu@xxxxxxxxxxxxxx>
>> Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
>> 
>> Best regards,
>>  Kan
>> 
>
>> diff -r aa2298739112 tools/python/xen/xm/main.py
>> --- a/tools/python/xen/xm/main.py    Fri Jun 09 10:40:31 2006 -0600
>> +++ b/tools/python/xen/xm/main.py    Mon Jun 12 20:40:13 2006 +0900
>> @@ -597,8 +597,16 @@ def xm_vcpu_pin(args):
>>      arg_check(args, "vcpu-pin", 3)
>>  
>>      dom  = args[0]
>> -    vcpu = int(args[1])
>> -    cpumap = cpu_make_map(args[2])
>> +    try:
>> +        vcpu = int(args[1])
>> +    except (ValueError, OverflowError):
>> +        err('Invalid argument: %s' % args[1])
>> +        sys.exit(1)
>> +    try:
>> +        cpumap = cpu_make_map(args[2])
>> +    except (ValueError, OverflowError):
>> +        err('Invalid argument: %s' % args[2])
>> +        sys.exit(1)
>>      
>>      server.xend.domain.pincpu(dom, vcpu, cpumap)
>>  
>> [Snip]
>
>It would be a lot nicer if you let the exceptions propagate, and then caught
>them in the main exception handler at the bottom of main.py.  It would also
> be
>better if you printed out the usage of the command to tell the user what 
>error
>they made.
>
>Thanks,
>
>Ewan.

Attachment: xm.patch
Description: Binary data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel