From: John Ferlan Date: Mon, 1 Feb 2016 14:59:44 +0000 (-0500) Subject: logical: Use 'stripes' value for mirror/raid segtype X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=c6d526f33f0a46bea122cf0a6e61be73294502e7;p=libvirt.git logical: Use 'stripes' value for mirror/raid segtype The 'stripes' value is described as the "Number of stripes or mirrors in a logical volume". So add "mirror" and anything that starts with "raid" to the list of segtypes that can have an 'nextents' value greater than one. Use of raid segtypes (raid1, raid4, raid5*, raid6*, and raid10) is favored over mirror in more recent lvm code. Signed-off-by: John Ferlan --- diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c index bb02d8af4b..cd0fec0108 100644 --- a/src/storage/storage_backend_logical.c +++ b/src/storage/storage_backend_logical.c @@ -65,6 +65,8 @@ virStorageBackendLogicalSetActive(virStoragePoolObjPtr pool, #define VIR_STORAGE_VOL_LOGICAL_SEGTYPE_STRIPED "striped" +#define VIR_STORAGE_VOL_LOGICAL_SEGTYPE_MIRROR "mirror" +#define VIR_STORAGE_VOL_LOGICAL_SEGTYPE_RAID "raid" struct virStorageBackendLogicalPoolVolData { virStoragePoolObjPtr pool; @@ -88,8 +90,17 @@ virStorageBackendLogicalParseVolExtents(virStorageVolDefPtr vol, memset(&extent, 0, sizeof(extent)); + /* Assume 1 extent (the regex for 'devices' is "(\\S+)") and only + * check the 'stripes' field if we have a striped, mirror, or one of + * the raid (raid1, raid4, raid5*, raid6*, or raid10) segtypes in which + * case the stripes field will denote the number of lv's within the + * 'devices' field in order to generate the proper regex to decode + * the field + */ nextents = 1; - if (STREQ(groups[4], VIR_STORAGE_VOL_LOGICAL_SEGTYPE_STRIPED)) { + if (STREQ(groups[4], VIR_STORAGE_VOL_LOGICAL_SEGTYPE_STRIPED) || + STREQ(groups[4], VIR_STORAGE_VOL_LOGICAL_SEGTYPE_MIRROR) || + STRPREFIX(groups[4], VIR_STORAGE_VOL_LOGICAL_SEGTYPE_RAID)) { if (virStrToLong_i(groups[5], NULL, 10, &nextents) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed volume extent stripes value"));