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

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



On Wed, Sep 21, 2011 at 01:39:22PM +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
> 
> The RE we uses:
> 
>     const char *regexes[] = {
>         "^\\s*(\\S+),(\\S*),(\\S+),(\\S+)\\((\\S+)\\),(\\S+),([0-9]+),?\\s*$"
>     };
> 
> This patch changes the seperator into "#" to fix the problem.
> 
> Related RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=727474
> ---
>  src/storage/storage_backend_logical.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
> index 4f42047..6c13a6b 100644
> --- a/src/storage/storage_backend_logical.c
> +++ b/src/storage/storage_backend_logical.c
> @@ -199,7 +199,7 @@ virStorageBackendLogicalFindLVs(virStoragePoolObjPtr pool,
>          7
>      };
>      const char *prog[] = {
> -        LVS, "--separator", ",", "--noheadings", "--units", "b",
> +        LVS, "--separator", "#", "--noheadings", "--units", "b",
>          "--unbuffered", "--nosuffix", "--options",
>          "lv_name,origin,uuid,devices,seg_size,vg_extent_size",
>          pool->def->source.name, NULL

  Err, it seems the regexp should be changed too ... as you wrote it
seems to expect ',' as the separator.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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