VIR_AUTOFREE(char *) mirrorType = NULL;
VIR_AUTOFREE(char *) ready = NULL;
VIR_AUTOFREE(char *) blockJob = NULL;
+ VIR_AUTOFREE(char *) index = NULL;
ctxt->node = cur;
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",
mirrorFormat = virXMLPropString(cur, "format");
}
- if (!(def->mirror = virDomainStorageSourceParseBase(mirrorType, mirrorFormat, NULL)))
+ if (!(def->mirror = virDomainStorageSourceParseBase(mirrorType, mirrorFormat,
+ index)))
return -1;
if (mirrorType) {
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)
<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/>
<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/>