]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virDomainBackupDefFormat: Propagate private data callbacks
authorPeter Krempa <pkrempa@redhat.com>
Mon, 1 Nov 2021 11:42:39 +0000 (12:42 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 4 Nov 2021 09:55:28 +0000 (10:55 +0100)
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>
src/conf/backup_conf.c
src/conf/backup_conf.h
src/qemu/qemu_backup.c
src/qemu/qemu_domain.c
tests/genericxml2xmltest.c

index 694553a544e2ae2bca4786d82f746ef278f4de42..2a7fa95e0cc99e1a84a724c928a5edf9257dbd7f 100644 (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;
     }
 
index b682da1c95cb8b103b64174009e27c2ee62ea64e..dc66b75892be554ae725f70067b7445a0b84210d 100644 (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,
index abbfcf368288607a92886102259879cf926af27f..9fa8d2f02e26e6b42479748e15f037402c5811a0 100644 (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);
index 209337404ace9b0e3763c27b8ca2889a79f73002..fb203bc83085081a2f3986601af3ea6aba1df5ce 100644 (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);
index a6f974e758bb51bccd10fbbe7bde5a71370cd15b..34ccaff61503288430c5e57206ec2b811b949b73 100644 (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;
     }