...
<source>
@@ -118,10 +126,28 @@
(pool types fs, logical, disk,
iscsi, zfs).
May be repeated multiple times depending on backend driver. Contains
- a single attribute path which is either the fully
+ a required attribute path which is either the fully
qualified path to the block device node or for iscsi
the iSCSI Qualified Name (IQN).
- Since 0.4.1
+ Since 0.4.1
+
An optional attribute part_separator for each
+ path may be supplied. Valid values for the attribute
+ may be either "yes" or "no". This attribute is to be used for a
+ disk pool type using a path to a
+ device mapper multipath device configured to utilize either
+ 'user_friendly_names' or a custom 'alias' name in the
+ /etc/multipath.conf. The attribute directs libvirt to not
+ generate device volume names with the partition character "p".
+ By default, when libvirt generates the partition names for
+ device mapper multipath devices it will add a "p" path separator
+ to the device name before adding the partition number. For example,
+ a device path of '/dev/mapper/mpatha' libvirt would
+ generate partition names of '/dev/mapper/mpathap1',
+ '/dev/mapper/mpathap2', etc. for each partition found. With
+ this attribute set to "no", libvirt will not append the "p" to
+ the name unless it ends with a number thus generating names
+ of '/dev/mapper/mpatha1', '/dev/mapper/mpatha2', etc.
+ Since 1.3.1
dir
Provides the source for pools backed by directories (pool
types dir, netfs, gluster),
diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng
index 3a61f04db4..49d212f7c7 100644
--- a/docs/schemas/storagepool.rng
+++ b/docs/schemas/storagepool.rng
@@ -278,6 +278,11 @@
+
+
+
+
+
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 7c81babd04..3657dfd54c 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1,7 +1,7 @@
/*
* storage_conf.c: config handling for storage driver
*
- * Copyright (C) 2006-2014 Red Hat, Inc.
+ * Copyright (C) 2006-2016 Red Hat, Inc.
* Copyright (C) 2006-2008 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -528,6 +528,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
goto cleanup;
for (i = 0; i < nsource; i++) {
+ char *partsep;
virStoragePoolSourceDevice dev = { .path = NULL };
dev.path = virXMLPropString(nodeset[i], "path");
@@ -537,10 +538,25 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
goto cleanup;
}
+ partsep = virXMLPropString(nodeset[i], "part_separator");
+ if (partsep) {
+ dev.part_separator = virTristateBoolTypeFromString(partsep);
+ if (dev.part_separator <= 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("invalid part_separator setting '%s'"),
+ partsep);
+ virStoragePoolSourceDeviceClear(&dev);
+ VIR_FREE(partsep);
+ goto cleanup;
+ }
+ VIR_FREE(partsep);
+ }
+
if (VIR_APPEND_ELEMENT(source->devices, source->ndevice, dev) < 0) {
virStoragePoolSourceDeviceClear(&dev);
goto cleanup;
}
+
}
source->dir = virXPathString("string(./dir/@path)", ctxt);
@@ -1051,8 +1067,14 @@ virStoragePoolSourceFormat(virBufferPtr buf,
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "\n");
} else {
- virBufferEscapeString(buf, "\n",
+ virBufferEscapeString(buf, "devices[i].path);
+ if (src->devices[i].part_separator !=
+ VIR_TRISTATE_SWITCH_ABSENT) {
+ virBufferAsprintf(buf, " part_separator='%s'",
+ virTristateBoolTypeToString(src->devices[i].part_separator));
+ }
+ virBufferAddLit(buf, "/>\n");
}
}
}
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index ec59c178cf..f1dc62b115 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -1,7 +1,7 @@
/*
* storage_conf.h: config handling for storage driver
*
- * Copyright (C) 2006-2008, 2010-2014 Red Hat, Inc.
+ * Copyright (C) 2006-2008, 2010-2016 Red Hat, Inc.
* Copyright (C) 2006-2008 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -157,6 +157,7 @@ struct _virStoragePoolSourceDevice {
virStoragePoolSourceDeviceExtentPtr freeExtents;
char *path;
int format; /* Pool specific source format */
+ int part_separator; /* enum virTristateSwitch */
/* When the source device is a physical disk,
* the geometry data is needed
diff --git a/tests/storagepoolxml2xmlin/pool-disk-device-nopartsep.xml b/tests/storagepoolxml2xmlin/pool-disk-device-nopartsep.xml
new file mode 100644
index 0000000000..71b381ef8f
--- /dev/null
+++ b/tests/storagepoolxml2xmlin/pool-disk-device-nopartsep.xml
@@ -0,0 +1,14 @@
+
+ multipath
+ 70a7eb15-6c34-ee9c-bf57-69e8e5ff3fb2
+ 0
+ 0
+ 0
+
+
+
+
+
+ /dev
+
+
diff --git a/tests/storagepoolxml2xmlout/pool-disk-device-nopartsep.xml b/tests/storagepoolxml2xmlout/pool-disk-device-nopartsep.xml
new file mode 100644
index 0000000000..71b381ef8f
--- /dev/null
+++ b/tests/storagepoolxml2xmlout/pool-disk-device-nopartsep.xml
@@ -0,0 +1,14 @@
+
+ multipath
+ 70a7eb15-6c34-ee9c-bf57-69e8e5ff3fb2
+ 0
+ 0
+ 0
+
+
+
+
+
+ /dev
+
+
diff --git a/tests/storagepoolxml2xmltest.c b/tests/storagepoolxml2xmltest.c
index b03c4b0176..41d69878cd 100644
--- a/tests/storagepoolxml2xmltest.c
+++ b/tests/storagepoolxml2xmltest.c
@@ -80,6 +80,7 @@ mymain(void)
DO_TEST("pool-logical-nopath");
DO_TEST("pool-logical-create");
DO_TEST("pool-disk");
+ DO_TEST("pool-disk-device-nopartsep");
DO_TEST("pool-iscsi");
DO_TEST("pool-iscsi-auth");
DO_TEST("pool-netfs");