mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 02:51:16 +00:00
Currently, you can define a logical storage pool with something like:
<pool type='logical'> <source> <name>MyVG</name> <device name='/dev/sdb'/> ... However, dumping out the XML for this same storage pool (with, say, virsh pool-dumpxml), gives: <pool type='logical'> <source> <name>MyVG</name> <device name='/dev/sdb'> </device> To make this more idempotent, do the <device name='/dev/sdb'/> form by default, and only do the <device>...</device> form if .nfreeExtent is defined for the storage pool. Signed-off-by: Chris Lalancette <clalance@redhat.com>
This commit is contained in:
parent
46db2b2968
commit
c6f0a7b2db
@ -1,3 +1,9 @@
|
|||||||
|
Tue Oct 21 19:22:00 CEST 2008 Chris Lalancette <clalance@redhat.com>
|
||||||
|
* src/storage_conf.c: Make logical pool dumpXML more idempotent with
|
||||||
|
defineXML by outputting <device name='/dev/sdb' /> when we are
|
||||||
|
dumping XML. We only use the longer <device
|
||||||
|
name='/dev/sdb'>foo</device> when a pool has .nfreeExtent defined.
|
||||||
|
|
||||||
Tue Oct 21 19:18:00 CEST 2008 Chris Lalancette <clalance@redhat.com>
|
Tue Oct 21 19:18:00 CEST 2008 Chris Lalancette <clalance@redhat.com>
|
||||||
* src/storage_conf.c: Make sure to set errors on paths where
|
* src/storage_conf.c: Make sure to set errors on paths where
|
||||||
->formatToString() or ->formatFromString() fail.
|
->formatToString() or ->formatFromString() fail.
|
||||||
|
@ -466,7 +466,7 @@ virStoragePoolDefFormat(virConnectPtr conn,
|
|||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
const char *type;
|
const char *type;
|
||||||
char uuid[VIR_UUID_STRING_BUFLEN];
|
char uuid[VIR_UUID_STRING_BUFLEN];
|
||||||
int i;
|
int i, j;
|
||||||
|
|
||||||
options = virStorageBackendPoolOptionsForType(def->type);
|
options = virStorageBackendPoolOptionsForType(def->type);
|
||||||
if (options == NULL)
|
if (options == NULL)
|
||||||
@ -499,16 +499,19 @@ virStoragePoolDefFormat(virConnectPtr conn,
|
|||||||
if ((options->flags & VIR_STORAGE_BACKEND_POOL_SOURCE_DEVICE) &&
|
if ((options->flags & VIR_STORAGE_BACKEND_POOL_SOURCE_DEVICE) &&
|
||||||
def->source.ndevice) {
|
def->source.ndevice) {
|
||||||
for (i = 0 ; i < def->source.ndevice ; i++) {
|
for (i = 0 ; i < def->source.ndevice ; i++) {
|
||||||
virBufferVSprintf(&buf," <device path='%s'>\n", def->source.devices[i].path);
|
|
||||||
if (def->source.devices[i].nfreeExtent) {
|
if (def->source.devices[i].nfreeExtent) {
|
||||||
int j;
|
virBufferVSprintf(&buf," <device path='%s'>\n",
|
||||||
|
def->source.devices[i].path);
|
||||||
for (j = 0 ; j < def->source.devices[i].nfreeExtent ; j++) {
|
for (j = 0 ; j < def->source.devices[i].nfreeExtent ; j++) {
|
||||||
virBufferVSprintf(&buf, " <freeExtent start='%llu' end='%llu'/>\n",
|
virBufferVSprintf(&buf, " <freeExtent start='%llu' end='%llu'/>\n",
|
||||||
def->source.devices[i].freeExtents[j].start,
|
def->source.devices[i].freeExtents[j].start,
|
||||||
def->source.devices[i].freeExtents[j].end);
|
def->source.devices[i].freeExtents[j].end);
|
||||||
}
|
}
|
||||||
|
virBufferAddLit(&buf," </device>\n");
|
||||||
}
|
}
|
||||||
virBufferAddLit(&buf," </device>\n");
|
else
|
||||||
|
virBufferVSprintf(&buf, " <device path='%s'/>\n",
|
||||||
|
def->source.devices[i].path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((options->flags & VIR_STORAGE_BACKEND_POOL_SOURCE_DIR) &&
|
if ((options->flags & VIR_STORAGE_BACKEND_POOL_SOURCE_DIR) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user