On 02/02/2016 03:11 AM, Ján Tomko wrote: > On Mon, Feb 01, 2016 at 03:29:53PM -0500, John Ferlan wrote: >> Modify the regex for the 'devices' (a/k/a 'extents') from "(\\S+)" >> (e.g., 1 or more) to "(\\S*)" (e.g., zero or more). >> >> Then for any "thin" lv's found, mark the volume as a sparse volume so >> that the volume wipe algorithm doesn't work. >> >> 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. >> > > A thin pool is another layer on top of some of the LVs in the VG. > I think it deserves a separate pool type. > >> 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 and >> checking for NULL/empty field during parse. >> >> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> >> --- >> src/storage/storage_backend_logical.c | 22 ++++++++++++++-------- >> 1 file changed, 14 insertions(+), 8 deletions(-) > >> @@ -342,7 +348,7 @@ virStorageBackendLogicalFindLVs(virStoragePoolObjPtr pool, >> * striped, so "," is not a suitable separator either (rhbz 727474). >> */ >> const char *regexes[] = { >> - "^\\s*(\\S+)#(\\S*)#(\\S+)#(\\S+)#(\\S+)#([0-9]+)#(\\S+)#([0-9]+)#([0-9]+)#(\\S+)#?\\s*$" >> + "^\\s*(\\S+)#(\\S*)#(\\S+)#(\\S*)#(\\S+)#([0-9]+)#(\\S+)#([0-9]+)#([0-9]+)#(\\S+)#?\\s*$" > > This regex and changes to it would be much more readable split into > multiple lines, like VIR_LOG_REGEX. > OK - so if I create a 5th patch with something like, is that what you'd like to see: +#define VIR_STORAGE_VOL_LOGICAL_PREFIX_REGEX "^\\s*" +#define VIR_STORAGE_VOL_LOGICAL_LV_NAME_REGEX "(\\S+)#" +#define VIR_STORAGE_VOL_LOGICAL_ORIGIN_REGEX "(\\S*)#" +#define VIR_STORAGE_VOL_LOGICAL_UUID_REGEX "(\\S+)#" +#define VIR_STORAGE_VOL_LOGICAL_DEVICES_REGEX "(\\S*)#" +#define VIR_STORAGE_VOL_LOGICAL_SEGTYPE_REGEX "(\\S+)#" +#define VIR_STORAGE_VOL_LOGICAL_STRIPES_REGEX "([0-9]+)#" +#define VIR_STORAGE_VOL_LOGICAL_SEG_SIZE_REGEX "(\\S+)#" +#define VIR_STORAGE_VOL_LOGICAL_VG_EXTENT_SIZE_REGEX "([0-9]+)#" +#define VIR_STORAGE_VOL_LOGICAL_SIZE_REGEX "([0-9]+)#" +#define VIR_STORAGE_VOL_LOGICAL_LV_ATTR_REGEX "(\\S+)#" +#define VIR_STORAGE_VOL_LOGICAL_SUFFIX_REGEX "?\\s*$" + +#define VIR_STORAGE_VOL_LOGICAL_REGEX_COUNT 10 +#define VIR_STORAGE_VOL_LOGICAL_REGEX \ + VIR_STORAGE_VOL_LOGICAL_PREFIX_REGEX \ + VIR_STORAGE_VOL_LOGICAL_LV_NAME_REGEX \ + VIR_STORAGE_VOL_LOGICAL_ORIGIN_REGEX \ + VIR_STORAGE_VOL_LOGICAL_UUID_REGEX \ + VIR_STORAGE_VOL_LOGICAL_DEVICES_REGEX \ + VIR_STORAGE_VOL_LOGICAL_SEGTYPE_REGEX \ + VIR_STORAGE_VOL_LOGICAL_STRIPES_REGEX \ + VIR_STORAGE_VOL_LOGICAL_SEG_SIZE_REGEX \ + VIR_STORAGE_VOL_LOGICAL_VG_EXTENT_SIZE_REGEX \ + VIR_STORAGE_VOL_LOGICAL_SIZE_REGEX \ + VIR_STORAGE_VOL_LOGICAL_LV_ATTR_REGEX \ + VIR_STORAGE_VOL_LOGICAL_SUFFIX_REGEX + and const char *regexes[] = { - "^\\s*(\\S+)#(\\S*)#(\\S+)#(\\S*)#(\\S+)#([0-9]+)#(\\S+)#([0-9]+)#([0-9]+)#(\\S+)#?\\s*$" + VIR_STORAGE_VOL_LOGICAL_REGEX }; int vars[] = { - 10 + VIR_STORAGE_VOL_LOGICAL_REGEX_COUNT }; -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list