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@xxxxxxxxxxxxxx>
Best regards,
Kan
>Hi Bastian,
>
>Thanks for your comment. I send new patch.
>
>
>Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
>
>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@xxxxxxxxxxxxxxxxxxx
>>http://lists.xensource.com/xen-devel
>
>-------------------------------text/plain-------------------------------
>_______________________________________________
>Xen-devel mailing list
>Xen-devel@xxxxxxxxxxxxxxxxxxx
>http://lists.xensource.com/xen-devel
arg_check_for_resource_list.patch
Description: Binary data
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|