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(a)tekcomms.com>,
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(a)redhat.com>
---
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