[PATCH 09/15] qemu: domain: Extract NBD disk migration private data formatting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We will be adding source data to it so extract it to a separate function.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d3beee5d87..0bca80f3c6 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2067,6 +2067,23 @@ qemuDomainObjPrivateXMLFormatPR(virBufferPtr buf,
 }


+static void
+qemuDomainObjPrivateXMLFormatNBDMigration(virBufferPtr buf,
+                                          virDomainObjPtr vm)
+{
+    size_t i;
+    virDomainDiskDefPtr disk;
+    qemuDomainDiskPrivatePtr diskPriv;
+
+    for (i = 0; i < vm->def->ndisks; i++) {
+        disk = vm->def->disks[i];
+        diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
+        virBufferAsprintf(buf, "<disk dev='%s' migrating='%s'/>\n",
+                          disk->dst, diskPriv->migrating ? "yes" : "no");
+    }
+}
+
+
 static int
 qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf,
                                  virDomainObjPtr vm,
@@ -2098,18 +2115,8 @@ qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf,
     if (priv->job.asyncJob != QEMU_ASYNC_JOB_NONE)
         virBufferAsprintf(&attrBuf, " flags='0x%lx'", priv->job.apiFlags);

-    if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT) {
-        size_t i;
-        virDomainDiskDefPtr disk;
-        qemuDomainDiskPrivatePtr diskPriv;
-
-        for (i = 0; i < vm->def->ndisks; i++) {
-            disk = vm->def->disks[i];
-            diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
-            virBufferAsprintf(&childBuf, "<disk dev='%s' migrating='%s'/>\n",
-                              disk->dst, diskPriv->migrating ? "yes" : "no");
-        }
-    }
+    if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT)
+        qemuDomainObjPrivateXMLFormatNBDMigration(&childBuf, vm);

     if (priv->job.migParams)
         qemuMigrationParamsFormat(&childBuf, priv->job.migParams);
-- 
2.16.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux