mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
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: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
4e797f1af9
commit
22b83a54f5
@ -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/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user