[libvirt] [PATCH 06/10] list: Add helper to convert strings separated by ', ' to array

Osier Yang jyang at redhat.com
Thu Sep 6 14:38:17 UTC 2012


On 2012年09月06日 00:24, Eric Blake wrote:
> On 09/04/2012 09:16 AM, Osier Yang wrote:
>> tools/virsh.c: New helper function vshStringToArray.
>> tools/virsh.h: Declare vshStringToArray.
>> tools/virsh-domain.c: use the helper in cmdUndefine.
>> ---
>>   tools/virsh-domain.c |   19 ++-----------------
>>   tools/virsh.c        |   44 ++++++++++++++++++++++++++++++++++++++++++++
>>   tools/virsh.h        |    1 +
>>   3 files changed, 47 insertions(+), 17 deletions(-)
>
> ACK.  This is a nice refactor for later use.
>
> But down the road, do we want to borrow a leaf from qemu's book, and
> allow for users to input ',,' for a literal comma that does not separate
> options?  If so, then we should merge in the double comma handling from
> vshParseSnapshotDiskspec (virsh-snapshot.c) into this function, and have
> that function also refactored to use this helper.  Without something
> like that, users cannot input a literal comma when listing
> comma-separated arguments.
>

That will be nice, but seems useless for virsh now, the only two
commands which have option accepts multiple values are undefine
and pool-list. For domain undefine, the volumes can't have ',' in
the name (see the schema), for pool-list, pool types can't have ','
either.

Regards,
Osier




More information about the libvir-list mailing list