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

Daniel P. Berrange berrange at redhat.com
Wed Sep 21 10:22:09 UTC 2011

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

   if ((vol->source.extents[vol->source.nextent].path =
         strdup(groups[3])) == NULL) {
        return -1;

    vol->source.extents[vol->source.nextent].start = offset * size;
    vol->source.extents[vol->source.nextent].end = (offset * size) + length;

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.

|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

More information about the libvir-list mailing list