提交 c6f0a7b2 编写于 作者: C Chris Lalancette

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: NChris Lalancette <clalance@redhat.com>
上级 46db2b29
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>
* src/storage_conf.c: Make sure to set errors on paths where
->formatToString() or ->formatFromString() fail.
......
......@@ -466,7 +466,7 @@ virStoragePoolDefFormat(virConnectPtr conn,
virBuffer buf = VIR_BUFFER_INITIALIZER;
const char *type;
char uuid[VIR_UUID_STRING_BUFLEN];
int i;
int i, j;
options = virStorageBackendPoolOptionsForType(def->type);
if (options == NULL)
......@@ -499,17 +499,20 @@ virStoragePoolDefFormat(virConnectPtr conn,
if ((options->flags & VIR_STORAGE_BACKEND_POOL_SOURCE_DEVICE) &&
def->source.ndevice) {
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) {
int j;
virBufferVSprintf(&buf," <device path='%s'>\n",
def->source.devices[i].path);
for (j = 0 ; j < def->source.devices[i].nfreeExtent ; j++) {
virBufferVSprintf(&buf, " <freeExtent start='%llu' end='%llu'/>\n",
def->source.devices[i].freeExtents[j].start,
def->source.devices[i].freeExtents[j].end);
}
}
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) &&
def->source.dir)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册