Masaki Kanno
2006-Jun-14 02:42 UTC
[Xen-devel] [PATCH] Fix xm commands so that the Traceback does not occur
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@lists.xensource.com 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 # xm vcpu-pin domUtemp x 1 Unexpected error: exceptions.ValueError Please report to xen-devel@lists.xensource.com 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 1173, in main rc = cmd(args) File "//usr/lib/python/xen/xm/main.py", line 600, in xm_vcpu_pin vcpu = int(args[1]) ValueError: invalid literal for int(): x 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@jp.fujitsu.com> Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com> Best regards, Kan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ewan Mellor
2006-Jun-14 14:35 UTC
Re: [Xen-devel] [PATCH] Fix xm commands so that the Traceback does not occur
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@lists.xensource.com > 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@jp.fujitsu.com> > Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com> > > 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. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Masaki Kanno
2006-Jun-15 09:10 UTC
Re: [Xen-devel] [PATCH] Fix xm commands so that the Traceback does not occur
Hi Ewan, Thanks for your comment. We will correct and resend our patch. 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@lists.xensource.com >> 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@jp.fujitsu.com> >> Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com> >> >> 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._______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Masaki Kanno
2006-Jun-15 10:41 UTC
[Xen-devel] [PATCH] [RESEND] Fix xm commands so that the Traceback does not occur
Hi, We reflected comment to our patch. Our patch has become very small. :-) Signed-off-by: Hiroyuki Yamamoto <yamamoto.hiroyu@jp.fujitsu.com> Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com> 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@lists.xensource.com >> 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@jp.fujitsu.com> >> Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com> >> >> 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._______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ewan Mellor
2006-Jun-15 10:53 UTC
[Xen-devel] Re: [PATCH] [RESEND] Fix xm commands so that the Traceback does not occur
On Thu, Jun 15, 2006 at 07:41:39PM +0900, Masaki Kanno wrote: Content-Description: Mail message body> Hi, > > We reflected comment to our patch. Our patch has become very small. :-) > > > Signed-off-by: Hiroyuki Yamamoto <yamamoto.hiroyu@jp.fujitsu.com> > Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>That''s a lot better ;-) Applied, thank you. Ewan. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel