forked from rpms/libvirt
104 lines
4.6 KiB
Diff
104 lines
4.6 KiB
Diff
From 0fe11b92a8278ffab202033a61340649b0296368 Mon Sep 17 00:00:00 2001
|
|
Message-Id: <0fe11b92a8278ffab202033a61340649b0296368@dist-git>
|
|
From: Peter Krempa <pkrempa@redhat.com>
|
|
Date: Tue, 31 Jan 2023 15:30:51 +0100
|
|
Subject: [PATCH] qemu: domain: Store fdset ID for disks passed to qemu via FD
|
|
|
|
To ensure that we can hot-unplug the disk including the associated fdset
|
|
we need to store the fdset ID in the status XML.
|
|
|
|
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
|
(cherry picked from commit f730b1e4f203cbabe363aab246d8a1679063f756)
|
|
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=2040272
|
|
---
|
|
src/qemu/qemu_domain.c | 17 ++++++++++++++++-
|
|
tests/qemustatusxml2xmldata/modern-in.xml | 3 +++
|
|
2 files changed, 19 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
|
index 226d4d6dc1..247134672b 100644
|
|
--- a/src/qemu/qemu_domain.c
|
|
+++ b/src/qemu/qemu_domain.c
|
|
@@ -1941,6 +1941,8 @@ qemuStorageSourcePrivateDataParse(xmlXPathContextPtr ctxt,
|
|
g_autofree char *httpcookiealias = NULL;
|
|
g_autofree char *tlskeyalias = NULL;
|
|
g_autofree char *thresholdEventWithIndex = NULL;
|
|
+ bool fdsetPresent = false;
|
|
+ unsigned int fdSetID;
|
|
|
|
src->nodestorage = virXPathString("string(./nodenames/nodename[@type='storage']/@name)", ctxt);
|
|
src->nodeformat = virXPathString("string(./nodenames/nodename[@type='format']/@name)", ctxt);
|
|
@@ -1957,7 +1959,9 @@ qemuStorageSourcePrivateDataParse(xmlXPathContextPtr ctxt,
|
|
httpcookiealias = virXPathString("string(./objects/secret[@type='httpcookie']/@alias)", ctxt);
|
|
tlskeyalias = virXPathString("string(./objects/secret[@type='tlskey']/@alias)", ctxt);
|
|
|
|
- if (authalias || encalias || httpcookiealias || tlskeyalias) {
|
|
+ fdsetPresent = virXPathUInt("string(./fdsets/fdset[@type='storage']/@id)", ctxt, &fdSetID) == 0;
|
|
+
|
|
+ if (authalias || encalias || httpcookiealias || tlskeyalias || fdsetPresent) {
|
|
if (!src->privateData &&
|
|
!(src->privateData = qemuDomainStorageSourcePrivateNew()))
|
|
return -1;
|
|
@@ -1975,6 +1979,9 @@ qemuStorageSourcePrivateDataParse(xmlXPathContextPtr ctxt,
|
|
|
|
if (qemuStorageSourcePrivateDataAssignSecinfo(&priv->tlsKeySecret, &tlskeyalias) < 0)
|
|
return -1;
|
|
+
|
|
+ if (fdsetPresent)
|
|
+ priv->fdpass = qemuFDPassNewPassed(fdSetID);
|
|
}
|
|
|
|
if (virStorageSourcePrivateDataParseRelPath(ctxt, src) < 0)
|
|
@@ -2008,6 +2015,7 @@ qemuStorageSourcePrivateDataFormat(virStorageSource *src,
|
|
qemuDomainStorageSourcePrivate *srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
|
|
g_auto(virBuffer) nodenamesChildBuf = VIR_BUFFER_INIT_CHILD(buf);
|
|
g_auto(virBuffer) objectsChildBuf = VIR_BUFFER_INIT_CHILD(buf);
|
|
+ g_auto(virBuffer) fdsetsChildBuf = VIR_BUFFER_INIT_CHILD(buf);
|
|
|
|
virBufferEscapeString(&nodenamesChildBuf, "<nodename type='storage' name='%s'/>\n", src->nodestorage);
|
|
virBufferEscapeString(&nodenamesChildBuf, "<nodename type='format' name='%s'/>\n", src->nodeformat);
|
|
@@ -2025,10 +2033,15 @@ qemuStorageSourcePrivateDataFormat(virStorageSource *src,
|
|
return -1;
|
|
|
|
if (srcPriv) {
|
|
+ unsigned int fdSetID;
|
|
+
|
|
qemuStorageSourcePrivateDataFormatSecinfo(&objectsChildBuf, srcPriv->secinfo, "auth");
|
|
qemuStorageSourcePrivateDataFormatSecinfo(&objectsChildBuf, srcPriv->encinfo, "encryption");
|
|
qemuStorageSourcePrivateDataFormatSecinfo(&objectsChildBuf, srcPriv->httpcookie, "httpcookie");
|
|
qemuStorageSourcePrivateDataFormatSecinfo(&objectsChildBuf, srcPriv->tlsKeySecret, "tlskey");
|
|
+
|
|
+ if (qemuFDPassIsPassed(srcPriv->fdpass, &fdSetID))
|
|
+ virBufferAsprintf(&fdsetsChildBuf, "<fdset type='storage' id='%u'/>\n", fdSetID);
|
|
}
|
|
|
|
if (src->tlsAlias)
|
|
@@ -2036,6 +2049,8 @@ qemuStorageSourcePrivateDataFormat(virStorageSource *src,
|
|
|
|
virXMLFormatElement(buf, "objects", NULL, &objectsChildBuf);
|
|
|
|
+ virXMLFormatElement(buf, "fdsets", NULL, &fdsetsChildBuf);
|
|
+
|
|
if (src->thresholdEventWithIndex)
|
|
virBufferAddLit(buf, "<thresholdEvent indexUsed='yes'/>\n");
|
|
|
|
diff --git a/tests/qemustatusxml2xmldata/modern-in.xml b/tests/qemustatusxml2xmldata/modern-in.xml
|
|
index 7759034f7a..f5beab722b 100644
|
|
--- a/tests/qemustatusxml2xmldata/modern-in.xml
|
|
+++ b/tests/qemustatusxml2xmldata/modern-in.xml
|
|
@@ -341,6 +341,9 @@
|
|
<secret type='tlskey' alias='tls-certificate-key-alias'/>
|
|
<TLSx509 alias='transport-alias'/>
|
|
</objects>
|
|
+ <fdsets>
|
|
+ <fdset type='storage' id='1337'/>
|
|
+ </fdsets>
|
|
<thresholdEvent indexUsed='yes'/>
|
|
</privateData>
|
|
</source>
|
|
--
|
|
2.39.1
|
|
|