[PATCH v2 6/6] logical: Display thin lv's found in a libvirt managed volume group

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

 



Modify the regex for the 'devices' (a/k/a 'extents') from "(\\S+)"
(e.g., 1 or more) to "(\\S*)" (e.g., zero or more).

Since a "thin" segtype has no devices, this will result in any "thin" lv
part of some thin-pool within a volume group used as a libvirt pool to be
displayed as a possible volume to use.

NB: Based on a proposal authored by Joe Harvell <joe.harvell@xxxxxxxxxxxx>,
but with much intervening rework, the resulting patch is changed from
the original concept. About all that remains is changing the regex.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/storage/storage_backend_logical.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index b866648..c56961d 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -81,9 +81,12 @@ virStorageBackendLogicalParseVolExtents(virStorageVolDefPtr vol,
     size_t i, nextents = 0;
     unsigned long long offset, size, length;
 
+    /* If the groups field is NULL, then there's nothing to do */
+    if (!groups[3])
+        return 0;
+
     /* The 'devices' (or extents) are split by a comma ",", so let's split
-     * each out into a parseable string. Since our regex to generate this
-     * data is "(\\S+)", we can safely assume at least one exists. */
+     * each out into a parseable string. */
     if (!(extents = virStringSplitCount(groups[3], ",", 0, &nextents)))
         goto cleanup;
 
@@ -296,7 +299,7 @@ virStorageBackendLogicalFindLVs(virStoragePoolObjPtr pool,
      *    striped, so "," is not a suitable separator either (rhbz 727474).
      */
     const char *regexes[] = {
-       "^\\s*(\\S+)#(\\S*)#(\\S+)#(\\S+)#(\\S+)#(\\S+)#([0-9]+)#([0-9]+)#(\\S+)#(\\S*)#?\\s*$"
+       "^\\s*(\\S+)#(\\S*)#(\\S+)#(\\S*)#(\\S+)#(\\S+)#([0-9]+)#([0-9]+)#(\\S+)#(\\S*)#?\\s*$"
     };
     int vars[] = {
         10
-- 
2.5.0

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]