virDomainBackupDefFormat: Propagate private data callbacks

The formatter for the backup job data didn't pass the virDomainXMLOption
struct to the disk formatter which meant that the private data of the
disk source were not formatted.

This didn't pose a problem for now as the blockjob list remembered the
nodenames for the jobs, but the backup source lost them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-11-01 12:42:39 +01:00
parent 8970094afd
commit 1e4aff444c
5 changed files with 13 additions and 8 deletions

View File

@ -318,7 +318,8 @@ static int
virDomainBackupDiskDefFormat(virBuffer *buf,
virDomainBackupDiskDef *disk,
bool push,
bool internal)
bool internal,
virDomainXMLOption *xmlopt)
{
g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
@ -358,7 +359,7 @@ virDomainBackupDiskDefFormat(virBuffer *buf,
if (virDomainDiskSourceFormat(&childBuf, disk->store, sourcename,
0, false, storageSourceFormatFlags,
false, false, NULL) < 0)
false, false, xmlopt) < 0)
return -1;
}
@ -390,7 +391,8 @@ virDomainBackupDefFormatPrivate(virBuffer *buf,
int
virDomainBackupDefFormat(virBuffer *buf,
virDomainBackupDef *def,
bool internal)
bool internal,
virDomainXMLOption *xmlopt)
{
g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
@ -418,7 +420,7 @@ virDomainBackupDefFormat(virBuffer *buf,
for (i = 0; i < def->ndisks; i++) {
if (virDomainBackupDiskDefFormat(&disksChildBuf, &def->disks[i],
def->type == VIR_DOMAIN_BACKUP_TYPE_PUSH,
internal) < 0)
internal, xmlopt) < 0)
return -1;
}

View File

@ -123,7 +123,8 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainBackupDef, virDomainBackupDefFree);
int
virDomainBackupDefFormat(virBuffer *buf,
virDomainBackupDef *def,
bool internal);
bool internal,
virDomainXMLOption *xmlopt);
int
virDomainBackupAlignDisks(virDomainBackupDef *backup,
virDomainDef *dom,

View File

@ -954,6 +954,8 @@ char *
qemuBackupGetXMLDesc(virDomainObj *vm,
unsigned int flags)
{
qemuDomainObjPrivate *priv = vm->privateData;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virDomainBackupDef *backup;
@ -962,7 +964,7 @@ qemuBackupGetXMLDesc(virDomainObj *vm,
if (!(backup = qemuDomainGetBackup(vm)))
return NULL;
if (virDomainBackupDefFormat(&buf, backup, false) < 0)
if (virDomainBackupDefFormat(&buf, backup, false, priv->driver->xmlopt) < 0)
return NULL;
return virBufferContentAndReset(&buf);

View File

@ -2152,7 +2152,7 @@ qemuDomainObjPrivateXMLFormatBackups(virBuffer *buf,
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
if (priv->backup &&
virDomainBackupDefFormat(&childBuf, priv->backup, true) < 0)
virDomainBackupDefFormat(&childBuf, priv->backup, true, priv->driver->xmlopt) < 0)
return -1;
virXMLFormatElement(buf, "backups", &attrBuf, &childBuf);

View File

@ -114,7 +114,7 @@ testCompareBackupXML(const void *opaque)
return -1;
}
if (virDomainBackupDefFormat(&buf, backup, data->internal) < 0) {
if (virDomainBackupDefFormat(&buf, backup, data->internal, NULL) < 0) {
VIR_TEST_VERBOSE("failed to format backup def '%s'", file_in);
return -1;
}