[libvirt] [PATCH] storage: Do not use comma as seperator for lvs output

Osier Yang jyang at redhat.com
Thu Sep 22 00:22:56 UTC 2011


于 2011年09月21日 18:22, Daniel P. Berrange 写道:
> On Wed, Sep 21, 2011 at 05:07:56PM +0800, Osier Yang wrote:
>> * src/storage/storage_backend_logical.c:
>>
>> If a logical vol is created with multiple stripes. (e.g. --stripes 3),
>> the "device" field of lvs output will have multiple fileds which are
>> seperated by comma. It means the RE we write in the codes will not
>> work well anymore. E.g. (lvs output for a stripped vol, uses "#" as
>> seperator here):
>>
>> test_stripes##fSLSZH-zAS2-yAIb-n4mV-Al9u-HA3V-oo9K1B#\
>> /dev/sdc1(10240),/dev/sdd1(0)#42949672960#4194304
> If the 'lv' output contains multiple paths tin the "device" field,
> then the issue of ',' vs '#' is the least of our worries.
>
> We use the path in the device field to populate the volume extents
> information.
>
>     if ((vol->source.extents[vol->source.nextent].path =
>           strdup(groups[3])) == NULL) {
>          virReportOOMError();
>          return -1;
>      }
>     ...
>
>      vol->source.extents[vol->source.nextent].start = offset * size;
>      vol->source.extents[vol->source.nextent].end = (offset * size) + length;
>      vol->source.nextent++;
>
> This code will need significantly rewriting to cope with multiple
> device paths when parsing the output, before we can make the change
> you suggest here.
>
> Regards,
> Daniel

Hmm, agreed, will make a new patch to cover this. Thanks

Osier




More information about the libvir-list mailing list