提交 22b83a54 编写于 作者: P Peter Krempa

conf: Add 'index' attribute for <disk><mirror><source>

Similarly to the disk source we need to keep the disk index (which is in
the qemu driver used for identification of the source for block jobs)
for the <mirror> element so that when it's replaced as a disk source
after pivoting all the allocated data is present.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 4e797f1a
......@@ -9311,6 +9311,7 @@ virDomainDiskDefMirrorParse(virDomainDiskDefPtr def,
VIR_AUTOFREE(char *) mirrorType = NULL;
VIR_AUTOFREE(char *) ready = NULL;
VIR_AUTOFREE(char *) blockJob = NULL;
VIR_AUTOFREE(char *) index = NULL;
ctxt->node = cur;
......@@ -9326,6 +9327,7 @@ virDomainDiskDefMirrorParse(virDomainDiskDefPtr def,
if ((mirrorType = virXMLPropString(cur, "type"))) {
mirrorFormat = virXPathString("string(./format/@type)", ctxt);
index = virXPathString("string(./source/@index)", ctxt);
} else {
if (def->mirrorJob != VIR_DOMAIN_BLOCK_JOB_TYPE_COPY) {
virReportError(VIR_ERR_XML_ERROR, "%s",
......@@ -9336,7 +9338,8 @@ virDomainDiskDefMirrorParse(virDomainDiskDefPtr def,
mirrorFormat = virXMLPropString(cur, "format");
}
if (!(def->mirror = virDomainStorageSourceParseBase(mirrorType, mirrorFormat, NULL)))
if (!(def->mirror = virDomainStorageSourceParseBase(mirrorType, mirrorFormat,
index)))
return -1;
if (mirrorType) {
......@@ -24030,7 +24033,7 @@ virDomainDiskDefFormatMirror(virBufferPtr buf,
virDomainDiskMirrorStateTypeToString(disk->mirrorState));
virBufferEscapeString(&childBuf, "<format type='%s'/>\n", formatStr);
if (virDomainDiskSourceFormat(&childBuf, disk->mirror, 0, false, flags, xmlopt) < 0)
if (virDomainDiskSourceFormat(&childBuf, disk->mirror, 0, true, flags, xmlopt) < 0)
return -1;
if (virDomainDiskBackingStoreFormat(&childBuf, disk->mirror, xmlopt, flags) < 0)
......
......@@ -45,8 +45,8 @@
<backingStore/>
<mirror type='file' file='/tmp/logcopy.img' format='qcow2' job='copy' ready='abort'>
<format type='qcow2'/>
<source file='/tmp/logcopy.img'/>
<backingStore type='block' index='1'>
<source file='/tmp/logcopy.img' index='1'/>
<backingStore type='block' index='2'>
<format type='raw'/>
<source dev='/dev/HostVG/backing'/>
<backingStore/>
......
......@@ -51,8 +51,8 @@
<backingStore/>
<mirror type='file' file='/tmp/logcopy.img' format='qcow2' job='copy' ready='abort'>
<format type='qcow2'/>
<source file='/tmp/logcopy.img'/>
<backingStore type='block' index='1'>
<source file='/tmp/logcopy.img' index='1'/>
<backingStore type='block' index='2'>
<format type='raw'/>
<source dev='/dev/HostVG/backing'/>
<backingStore/>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册