[PATCH 2/6] qemuBlockReopenFormat: Extract @src handling and monitor invocation

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

 



This will simplify testing of the blockdev-reopen code once it's
enabled.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_block.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 6627d044cd..c96be8b52d 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3299,6 +3299,22 @@ qemuBlockBitmapsHandleCommitFinish(virStorageSource *topsrc,
 }


+static int
+qemuBlockReopenFormatMon(qemuMonitor *mon,
+                         virStorageSource *src)
+{
+    g_autoptr(virJSONValue) reopenprops = NULL;
+
+    if (!(reopenprops = qemuBlockStorageSourceGetBlockdevProps(src, src->backingStore)))
+        return -1;
+
+    if (qemuMonitorBlockdevReopen(mon, &reopenprops) < 0)
+        return -1;
+
+    return 0;
+}
+
+
 /**
  * qemuBlockReopenFormat:
  * @vm: domain object
@@ -3316,7 +3332,6 @@ qemuBlockReopenFormat(virDomainObj *vm,
 {
     qemuDomainObjPrivate *priv = vm->privateData;
     virQEMUDriver *driver = priv->driver;
-    g_autoptr(virJSONValue) reopenprops = NULL;
     int rc;

     /* If we are lacking the object here, qemu might have opened an image with
@@ -3327,13 +3342,10 @@ qemuBlockReopenFormat(virDomainObj *vm,
         return -1;
     }

-    if (!(reopenprops = qemuBlockStorageSourceGetBlockdevProps(src, src->backingStore)))
-        return -1;
-
     if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
         return -1;

-    rc = qemuMonitorBlockdevReopen(priv->mon, &reopenprops);
+    rc = qemuBlockReopenFormatMon(priv->mon, src);

     if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
         return -1;
-- 
2.31.1




[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