Masaki Kanno
2006-Jun-22 13:22 UTC
[Xen-devel] [PATCH] Fix xm network-list/block-list/vtpm-list
Hi, When I tested xm commands, I saw the following error messages. The cause is because arg_check() counts a split(--). #xm network-list -l -- -vm1 Error: ''xm network-list'' requires between 1 and 2 arguments. #xm block-list -l -- -vm1 Error: ''xm block-list'' requires between 1 and 2 arguments. #xm vtpm-list -l -- -vm1 Error: ''xm vtpm-list'' requires between 1 and 2 arguments. I corrected for arg_check() not to count the split(--). The following are test results. # xm network-list -l -- -vm1 (0 ((backend-id 0) (mac 00:16:3e:10:56:fa) (handle 0) (state 4) (backend /local/domain/0/backend/vif/11/0) (tx-ring-ref 521) (rx-ring-ref 522) (event-channel 7) ) ) # xm network-list --long -- -vm1 (0 ((backend-id 0) (mac 00:16:3e:10:56:fa) (handle 0) (state 4) (backend /local/domain/0/backend/vif/11/0) (tx-ring-ref 521) (rx-ring-ref 522) (event-channel 7) ) ) # xm block-list --long -- -vm1 (2049 ((virtual-device 2049) (backend-id 0) (state 4) (backend /local/domain/0/backend/vbd/12/2049) (ring-ref 8) (event-channel 6) ) ) # xm block-list -l -- -vm1 (2049 ((virtual-device 2049) (backend-id 0) (state 4) (backend /local/domain/0/backend/vbd/12/2049) (ring-ref 8) (event-channel 6) ) ) # xm vtpm-list -l -- -vm1 (0 ((backend-id 0) (state 1) (handle 0) (backend /local/domain/0/backend/vtpm/10/0) ) ) # xm vtpm-list --long -- -vm1 (0 ((backend-id 0) (state 1) (handle 0) (backend /local/domain/0/backend/vtpm/10/0) ) ) 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
Bastian Blank
2006-Jun-22 13:40 UTC
Re: [Xen-devel] [PATCH] Fix xm network-list/block-list/vtpm-list
> diff -r 411a3c01bb40 tools/python/xen/xm/main.py > --- a/tools/python/xen/xm/main.py Tue Jun 20 18:51:46 2006 +0100 > +++ b/tools/python/xen/xm/main.py Thu Jun 22 15:50:35 2006 +0900 > @@ -276,7 +276,13 @@ for command in all_commands: > #################################################################### > > def arg_check(args, name, lo, hi = -1): > - n = len(args) > + # remove split(--) from args > + new_args = [] > + for x in args: > + if x != ''--'': > + new_args.append(x) > + > + n = len(new_args)You don''t mean "n = len([i for i in args if i != ''--''])"? Bastian -- Extreme feminine beauty is always disturbing. -- Spock, "The Cloud Minders", stardate 5818.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Masaki Kanno
2006-Jun-22 14:01 UTC
Re: [Xen-devel] [PATCH] Fix xm network-list/block-list/vtpm-list
Hi Bastian, Thanks for your comment. I send new patch. Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com> Best regards, Kan>> diff -r 411a3c01bb40 tools/python/xen/xm/main.py >> --- a/tools/python/xen/xm/main.py Tue Jun 20 18:51:46 2006 +0100 >> +++ b/tools/python/xen/xm/main.py Thu Jun 22 15:50:35 2006 +0900 >> @@ -276,7 +276,13 @@ for command in all_commands: >> #################################################################### >> >> def arg_check(args, name, lo, hi = -1): >> - n = len(args) >> + # remove split(--) from args >> + new_args = [] >> + for x in args: >> + if x != ''--'': >> + new_args.append(x) >> + >> + n = len(new_args) > >You don''t mean "n = len([i for i in args if i != ''--''])"? > >Bastian > >-- >Extreme feminine beauty is always disturbing. > -- Spock, "The Cloud Minders", stardate 5818.4 > >_______________________________________________ >Xen-devel mailing list >Xen-devel@lists.xensource.com >http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Masaki Kanno
2006-Jun-23 12:14 UTC
[Xen-devel] [PATCH] [RESEND] Fix xm network-list/block-list/vtpm-list
Hi, Sorry, my patch includes a small miss. A command error occurred when the split(--) was added to other xm commands before. However, the command error does not occur because of my patch. The following is example. Before: # xm log -- Error: ''xm log'' requires 0 argument. After: # xm log -- [2006-04-23 22:37:19 xend.XendDomainInfo] DEBUG (XendDomainInfo:877) XendDomainInfo.handleShutdownWatch [2006-04-23 22:41:14 xend] INFO (SrvDaemon:278) Xend Daemon started (snip) When I tested xm network-list/block-list/vtpm-list command more, I found other bug. When these xm commands specify two domains, a command error does not occur. However, when these xm commands specify more than three domains, the command error occurs. The following is example. # xm block-list vm1 vm2 Vdev BE handle state evt-ch ring-ref BE-path 769 0 0 4 6 8 /local/domain/0/backend/vbd/2/769 # xm block-list vm1 vm2 vm3 Error: ''xm block-list'' requires between 1 and 2 arguments. block-list <DomId> [--long] List virtual block devices for a domain I made a new patch that solved these problems. New patch processes these commands as follows. 1. Remove has_long_option() and add arg_check_for_resource_list() instead. 2. ''args'' tells ''options'' from ''params'' by using gnu_getopt(). 3. ''options'' checks whether -l/--long option is specified. 4. If ''params'' not given, print out ''No domain parameter given'' and usage. 5. If ''params'' given multiple domains, print out ''No multiple domain parameters allowed'' and usage. 6. Then it displays the resources as usual. Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com> Best regards, Kan>Hi Bastian, > >Thanks for your comment. I send new patch. > > >Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com> > >Best regards, > Kan > >>> diff -r 411a3c01bb40 tools/python/xen/xm/main.py >>> --- a/tools/python/xen/xm/main.py Tue Jun 20 18:51:46 2006 +0100 >>> +++ b/tools/python/xen/xm/main.py Thu Jun 22 15:50:35 2006 +0900 >>> @@ -276,7 +276,13 @@ for command in all_commands: >>> #################################################################### >>> >>> def arg_check(args, name, lo, hi = -1): >>> - n = len(args) >>> + # remove split(--) from args >>> + new_args = [] >>> + for x in args: >>> + if x != ''--'': >>> + new_args.append(x) >>> + >>> + n = len(new_args) >> >>You don''t mean "n = len([i for i in args if i != ''--''])"? >> >>Bastian >> >>-- >>Extreme feminine beauty is always disturbing. >> -- Spock, "The Cloud Minders", stardate 5818.4 >> >>_______________________________________________ >>Xen-devel mailing list >>Xen-devel@lists.xensource.com >>http://lists.xensource.com/xen-devel > >-------------------------------text/plain------------------------------- >_______________________________________________ >Xen-devel mailing list >Xen-devel@lists.xensource.com >http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel