Re: [libvirt] [PATCH] Fix logical storage pool operation on SLES10-SP2

2008-07-30 Thread Daniel Veillard
On Mon, Jul 28, 2008 at 03:35:30PM -0400, David Lively wrote:
 The attached patch adjusts for a difference in behavior in the LVM
 utilities 'lvs' and 'vgs'.  The SLES10-SP2 versions of these (and
 presumably others) append a trailing separator.  This patch simply
 adjusts the regexps to allow (but not require) this.
 
 I thought just adding the :? to the regexps would do this, but this
 was leaving the trailing separator in the last group match, so I ended
 up tweaking the preceding group pattern as well.

  Okay, looks simple and well contained.
  Applied and commited,

thanks !

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard  | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

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


Re: [libvirt] [PATCH] Fix logical storage pool operation on SLES10-SP2

2008-07-29 Thread Daniel P. Berrange
On Mon, Jul 28, 2008 at 03:35:30PM -0400, David Lively wrote:
 The attached patch adjusts for a difference in behavior in the LVM
 utilities 'lvs' and 'vgs'.  The SLES10-SP2 versions of these (and
 presumably others) append a trailing separator.  This patch simply
 adjusts the regexps to allow (but not require) this.
 
 I thought just adding the :? to the regexps would do this, but this
 was leaving the trailing separator in the last group match, so I ended
 up tweaking the preceding group pattern as well.

Yeah, the \S+ is a greedy match, so it'd consume the ':' first. I don't
know if POSIX expressions have a non-greedy match modifir like Perl does.
That would let you do

   (\\S+?):?

But in any case, your suggested modification is fine, so ACK.

BTW, what version of the LVM tools is SLES using - its probably useful
to note that in the comment you added, in case the same problem is 
particular to a version, rather than just SLES

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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


Re: [libvirt] [PATCH] Fix logical storage pool operation on SLES10-SP2

2008-07-29 Thread David Lively
On Tue, 2008-07-29 at 09:44 +0100, Daniel P. Berrange wrote:
 BTW, what version of the LVM tools is SLES using - its probably useful
 to note that in the comment you added, in case the same problem is 
 particular to a version, rather than just SLES

lvm2 2.02.17 (-7.19, x86_64)

But it's hard to know (without reading the ChangeLog in detail) how much
backporting is hidden in the distro-specific part of the version
(-7.19) ...

Dave


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


[libvirt] [PATCH] Fix logical storage pool operation on SLES10-SP2

2008-07-28 Thread David Lively
The attached patch adjusts for a difference in behavior in the LVM
utilities 'lvs' and 'vgs'.  The SLES10-SP2 versions of these (and
presumably others) append a trailing separator.  This patch simply
adjusts the regexps to allow (but not require) this.

I thought just adding the :? to the regexps would do this, but this
was leaving the trailing separator in the last group match, so I ended
up tweaking the preceding group pattern as well.

Dave

commit 021470f5cfa0e770f09c73cf8a2fc270121378f6
Author: David Lively [EMAIL PROTECTED]
Date:   Mon Jul 28 15:05:30 2008 -0400

Some distros' (e.g. SLES10-SP2) lvm utilities (lvs, vgs) put the specified
separator at the end of each input line.  Adjusted the regexes used by the
logical storage backend to allow this.

Signed-off-by: David Lively [EMAIL PROTECTED]

diff --git a/src/storage_backend_logical.c b/src/storage_backend_logical.c
index 674a74f..52e645b 100644
--- a/src/storage_backend_logical.c
+++ b/src/storage_backend_logical.c
@@ -201,9 +201,11 @@ virStorageBackendLogicalFindLVs(virConnectPtr conn,
  * Pull out name  uuid, device, device extent start #, segment size, extent size.
  *
  * NB can be multiple rows per volume if they have many extents
+ *
+ * NB lvs from some distros (e.g. SLES10 SP2) outputs trailing : on each line
  */
 const char *regexes[] = {
-^\\s*(\\S+):(\\S+):(\\S+)\\((\\S+)\\):(\\S+):(\\S+)\\s*$
+^\\s*(\\S+):(\\S+):(\\S+)\\((\\S+)\\):(\\S+):([0-9]+):?\\s*$
 };
 int vars[] = {
 6
@@ -442,9 +444,11 @@ virStorageBackendLogicalRefreshPool(virConnectPtr conn,
  *10603200512:4328521728
  *
  * Pull out size  free
+ *
+ * NB vgs from some distros (e.g. SLES10 SP2) outputs trailing : on each line
  */
 const char *regexes[] = {
-^\\s*(\\S+):(\\S+)\\s*$
+^\\s*(\\S+):([0-9]+):?\\s*$
 };
 int vars[] = {
 2
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list