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(a)redhat.com>
---
src/conf/backup_conf.c | 10 ++++++----
src/conf/backup_conf.h | 3 ++-
src/qemu/qemu_backup.c | 4 +++-
src/qemu/qemu_domain.c | 2 +-
tests/genericxml2xmltest.c | 2 +-
5 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c
index 694553a544..2a7fa95e0c 100644
--- a/src/conf/backup_conf.c
+++ b/src/conf/backup_conf.c
@@ -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;
}
diff --git a/src/conf/backup_conf.h b/src/conf/backup_conf.h
index b682da1c95..dc66b75892 100644
--- a/src/conf/backup_conf.h
+++ b/src/conf/backup_conf.h
@@ -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,
diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c
index abbfcf3682..9fa8d2f02e 100644
--- a/src/qemu/qemu_backup.c
+++ b/src/qemu/qemu_backup.c
@@ -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);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 209337404a..fb203bc830 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -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);
diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c
index a6f974e758..34ccaff615 100644
--- a/tests/genericxml2xmltest.c
+++ b/tests/genericxml2xmltest.c
@@ -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;
}
--
2.31.1