render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
Blob Blame History Raw
From bf15c630b7c54637220af65ac84cfd007c1c798a Mon Sep 17 00:00:00 2001
Message-Id: <bf15c630b7c54637220af65ac84cfd007c1c798a@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 31 Jan 2023 15:35:05 +0100
Subject: [PATCH] qemu: block: Properly handle FD-passed disk hot-(un-)plug

The hotplug code paths need to be able to pass the FDs to the monitor to
ensure that hotplug works.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 3b8d669d557bd2ce8874f61e83b6d6074d365ec2)

https://bugzilla.redhat.com/show_bug.cgi?id=2040272
---
 src/qemu/qemu_block.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index e865aa17f9..c218262691 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -1410,6 +1410,9 @@ qemuBlockStorageSourceAttachApplyStorageDeps(qemuMonitor *mon,
         qemuMonitorAddObject(mon, &data->tlsProps, &data->tlsAlias) < 0)
         return -1;
 
+    if (qemuFDPassTransferMonitor(data->fdpass, mon) < 0)
+        return -1;
+
     return 0;
 }
 
@@ -1559,6 +1562,8 @@ qemuBlockStorageSourceAttachRollback(qemuMonitor *mon,
     if (data->tlsKeySecretAlias)
         ignore_value(qemuMonitorDelObject(mon, data->tlsKeySecretAlias, false));
 
+    qemuFDPassTransferMonitorRollback(data->fdpass, mon);
+
     virErrorRestore(&orig_err);
 }
 
@@ -1609,6 +1614,8 @@ qemuBlockStorageSourceDetachPrepare(virStorageSource *src)
 
         if (srcpriv->tlsKeySecret)
             data->tlsKeySecretAlias = g_strdup(srcpriv->tlsKeySecret->alias);
+
+        data->fdpass = srcpriv->fdpass;
     }
 
     return g_steal_pointer(&data);
-- 
2.39.1