Re: [PATCH] virsh: Fix a problem of argv parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/05/2011 06:38 AM, Osier Yang wrote:
> Problem example:
>   # virsh -d 5 vol-create --pool default col.xml
>   vol-create: pool(optdata): default
>   vol-create: pool(optdata): col.xml
>   error: command 'vol-create' requires <file> option
> 
>   It gets same "vshCmdOptDef" for both "--pool default"
>   and "col.xml".
> 
> This patch fixes it by increase "data_ct" when things like
> "--pool default" is successfully parsed, so that could
> get right "vshCmdOptDef" for the other arguments which
> are not with option name together.

While I agree that this patch appears to fix the problem, I'd feel much
better if we _also_ added a test case to prove we don't regress in the
future (especially since we might be making future changes to argument
parsing to improve tab-completion or unambiguous prefix support).

It looks like the following are impacted (at least these are the
commands with more than one VSH_OT_DATA/VSH_OFLAG_REQ option):
domblkstat
domifstat
domblkinfo
save
dump
vcpupin
setvcpus
setmem
setmaxmem
domxml-from-native
domxml-to-native
migrate
migrate-setmaxdowntime
pool-define-as
pool-create-as
vol-create-as
vol-create
vol-create-from
vol-clone
vol-upload
vol-download
secret-set-value
attach-device
detach-device
update-device
attach-interface
detach-interface
attach-disk
detach-disk
snapshot-dumpxml
snapshot-revert
snapshot-delete
qemu-monitor-command


And since test:///default supports setvcpus, a valid test might be to
copy the layout of virsh-schedinfo as framework, and test that all of
these are equivalent:

virsh -c test:///default setvcpus test 2
virsh -c test:///default setvcpus --domain test 2
virsh -c test:///default setvcpus --domain=test 2
virsh -c test:///default setvcpus test --count 2
virsh -c test:///default setvcpus test --count=2
virsh -c test:///default setvcpus --domain test --count 2
virsh -c test:///default setvcpus --domain=test --count 2
virsh -c test:///default setvcpus --domain test --count=2
virsh -c test:///default setvcpus --domain=test --count=2
virsh -c test:///default setvcpus --count 2 --domain test
virsh -c test:///default setvcpus --count 2 --domain=test
virsh -c test:///default setvcpus --count=2 --domain test
virsh -c test:///default setvcpus --count=2 --domain=test

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]