forked from rpms/libvirt
libvirt-9.0.0-3.el9
- src: Don't use virReportSystemError() on virProcessGetStatInfo() failure (rhbz#2148266) - qemu: Provide virDomainGetCPUStats() implementation for session connection (rhbz#2148266) - virsh: Make domif-setlink work more than once (rhbz#2165466) - qemu_fd: Remove declaration for 'qemuFDPassNewDirect' (rhbz#2040272) - qemuStorageSourcePrivateDataFormat: Rename 'tmp' to 'objectsChildBuf' (rhbz#2040272) - qemu: command: Handle FD passing commandline via qemuBuildBlockStorageSourceAttachDataCommandline (rhbz#2040272) - qemuFDPassTransferCommand: Mark that FD was passed (rhbz#2040272) - qemu: fd: Add helpers allowing storing FD set data in status XML (rhbz#2040272) - qemu: domain: Store fdset ID for disks passed to qemu via FD (rhbz#2040272) - qemu: block: Properly handle FD-passed disk hot-(un-)plug (rhbz#2040272) Resolves: rhbz#2040272, rhbz#2148266, rhbz#2165466
This commit is contained in:
parent
86af401d07
commit
ff5db98bff
@ -0,0 +1,105 @@
|
||||
From ec03aa23ac417797f9b53d51b6f999f5e966f9d7 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <ec03aa23ac417797f9b53d51b6f999f5e966f9d7@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Mon, 16 Jan 2023 12:46:09 +0100
|
||||
Subject: [PATCH] qemu: Provide virDomainGetCPUStats() implementation for
|
||||
session connection
|
||||
|
||||
We have virDomainGetCPUStats() API which offers querying
|
||||
statistics on host CPU usage by given guest. And it works in two
|
||||
modes: getting overall stats (@start_cpu == -1, @ncpus == 1) or
|
||||
getting per host CPU usage.
|
||||
|
||||
For the QEMU driver it is implemented by looking into values
|
||||
stored in corresponding cpuacct CGroup controller. Well, this
|
||||
works for system instances, where libvirt has permissions to
|
||||
create CGroups and place QEMU process into them. But it does not
|
||||
fly for session connection, where no CGroups are set up.
|
||||
|
||||
Fortunately, we can do something similar to v8.8.0-rc1~95 and use
|
||||
virProcessGetStatInfo() to fill the overall stats. Unfortunately,
|
||||
I haven't found any source of per host CPU usage, so we just
|
||||
continue throwing an error in that case.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
(cherry picked from commit 8865c42771600a40eddf40663f73b458423059a4)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2148266
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_driver.c | 52 ++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 50 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||||
index c576c601ad..0603af6a35 100644
|
||||
--- a/src/qemu/qemu_driver.c
|
||||
+++ b/src/qemu/qemu_driver.c
|
||||
@@ -16009,6 +16009,50 @@ qemuDomainGetMetadata(virDomainPtr dom,
|
||||
return ret;
|
||||
}
|
||||
|
||||
+#define QEMU_CPU_STATS_PROC_TOTAL 3
|
||||
+
|
||||
+static int
|
||||
+qemuDomainGetCPUStatsProc(virDomainObj *vm,
|
||||
+ virTypedParameterPtr params,
|
||||
+ unsigned int nparams)
|
||||
+{
|
||||
+ unsigned long long cpuTime = 0;
|
||||
+ unsigned long long userTime = 0;
|
||||
+ unsigned long long sysTime = 0;
|
||||
+
|
||||
+ if (nparams == 0) {
|
||||
+ /* return supported number of params */
|
||||
+ return QEMU_CPU_STATS_PROC_TOTAL;
|
||||
+ }
|
||||
+
|
||||
+ if (virProcessGetStatInfo(&cpuTime, &userTime, &sysTime,
|
||||
+ NULL, NULL, vm->pid, 0) < 0) {
|
||||
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
||||
+ _("cannot read cputime for domain"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (virTypedParameterAssign(¶ms[0], VIR_DOMAIN_CPU_STATS_CPUTIME,
|
||||
+ VIR_TYPED_PARAM_ULLONG, cpuTime) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (nparams > 1 &&
|
||||
+ virTypedParameterAssign(¶ms[1], VIR_DOMAIN_CPU_STATS_USERTIME,
|
||||
+ VIR_TYPED_PARAM_ULLONG, userTime) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (nparams > 2 &&
|
||||
+ virTypedParameterAssign(¶ms[2], VIR_DOMAIN_CPU_STATS_SYSTEMTIME,
|
||||
+ VIR_TYPED_PARAM_ULLONG, sysTime) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (nparams > 3)
|
||||
+ nparams = 3;
|
||||
+
|
||||
+ return nparams;
|
||||
+}
|
||||
+
|
||||
+#undef QEMU_CPU_STATS_PROC_TOTAL
|
||||
|
||||
static int
|
||||
qemuDomainGetCPUStats(virDomainPtr domain,
|
||||
@@ -16037,8 +16081,12 @@ qemuDomainGetCPUStats(virDomainPtr domain,
|
||||
goto cleanup;
|
||||
|
||||
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUACCT)) {
|
||||
- virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
- "%s", _("cgroup CPUACCT controller is not mounted"));
|
||||
+ if (start_cpu == -1) {
|
||||
+ ret = qemuDomainGetCPUStatsProc(vm, params, nparams);
|
||||
+ } else {
|
||||
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
+ _("cgroup CPUACCT controller is not mounted"));
|
||||
+ }
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
--
|
||||
2.39.1
|
||||
|
@ -0,0 +1,53 @@
|
||||
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
|
||||
|
@ -0,0 +1,117 @@
|
||||
From 659a0e3cda2f5561abe45ccc10afc41014d1a331 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <659a0e3cda2f5561abe45ccc10afc41014d1a331@dist-git>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Tue, 31 Jan 2023 14:37:40 +0100
|
||||
Subject: [PATCH] qemu: command: Handle FD passing commandline via
|
||||
qemuBuildBlockStorageSourceAttachDataCommandline
|
||||
|
||||
Copy the pointer to qemuFDPass into struct qemuBlockStorageSourceAttachData
|
||||
so that it can be used from qemuBuildBlockStorageSourceAttachDataCommandline
|
||||
rather than looping again in qemuBuildDiskSourceCommandLineFDs.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
(cherry picked from commit 65f14232fb031b57fad085a2e8792da87c97173f)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2040272
|
||||
---
|
||||
src/qemu/qemu_block.h | 2 ++
|
||||
src/qemu/qemu_command.c | 26 +++----------------
|
||||
.../disk-source-fd.x86_64-latest.args | 6 ++---
|
||||
3 files changed, 9 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
|
||||
index eac986e0f0..5a61a19da2 100644
|
||||
--- a/src/qemu/qemu_block.h
|
||||
+++ b/src/qemu/qemu_block.h
|
||||
@@ -99,6 +99,8 @@ struct qemuBlockStorageSourceAttachData {
|
||||
char *tlsAlias;
|
||||
virJSONValue *tlsKeySecretProps;
|
||||
char *tlsKeySecretAlias;
|
||||
+
|
||||
+ qemuFDPass *fdpass;
|
||||
};
|
||||
|
||||
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index b96f2d33c1..5edad046d5 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -2119,6 +2119,8 @@ qemuBuildBlockStorageSourceAttachDataCommandline(virCommand *cmd,
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ qemuFDPassTransferCommand(data->fdpass, cmd);
|
||||
+
|
||||
if (data->storageProps) {
|
||||
if (!(tmp = virJSONValueToString(data->storageProps, false)))
|
||||
return -1;
|
||||
@@ -2147,25 +2149,6 @@ qemuBuildBlockStorageSourceAttachDataCommandline(virCommand *cmd,
|
||||
}
|
||||
|
||||
|
||||
-static int
|
||||
-qemuBuildDiskSourceCommandLineFDs(virCommand *cmd,
|
||||
- virDomainDiskDef *disk)
|
||||
-{
|
||||
- virStorageSource *n;
|
||||
-
|
||||
- for (n = disk->src; virStorageSourceIsBacking(n); n = n->backingStore) {
|
||||
- qemuDomainStorageSourcePrivate *srcpriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(n);
|
||||
-
|
||||
- if (!srcpriv || !srcpriv->fdpass)
|
||||
- continue;
|
||||
-
|
||||
- qemuFDPassTransferCommand(srcpriv->fdpass, cmd);
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-
|
||||
static int
|
||||
qemuBuildDiskSourceCommandLine(virCommand *cmd,
|
||||
virDomainDiskDef *disk,
|
||||
@@ -2183,9 +2166,6 @@ qemuBuildDiskSourceCommandLine(virCommand *cmd,
|
||||
if (virStorageSourceIsEmpty(disk->src))
|
||||
return 0;
|
||||
|
||||
- if (qemuBuildDiskSourceCommandLineFDs(cmd, disk) < 0)
|
||||
- return -1;
|
||||
-
|
||||
if (!(data = qemuBuildStorageSourceChainAttachPrepareBlockdev(disk->src)))
|
||||
return -1;
|
||||
|
||||
@@ -10537,6 +10517,8 @@ qemuBuildStorageSourceAttachPrepareCommon(virStorageSource *src,
|
||||
|
||||
tlsKeySecretAlias = srcpriv->tlsKeySecret->alias;
|
||||
}
|
||||
+
|
||||
+ data->fdpass = srcpriv->fdpass;
|
||||
}
|
||||
|
||||
if (src->haveTLS == VIR_TRISTATE_BOOL_YES &&
|
||||
diff --git a/tests/qemuxml2argvdata/disk-source-fd.x86_64-latest.args b/tests/qemuxml2argvdata/disk-source-fd.x86_64-latest.args
|
||||
index b4a81acfc7..a7ddd65000 100644
|
||||
--- a/tests/qemuxml2argvdata/disk-source-fd.x86_64-latest.args
|
||||
+++ b/tests/qemuxml2argvdata/disk-source-fd.x86_64-latest.args
|
||||
@@ -33,13 +33,13 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
|
||||
-blockdev '{"driver":"file","filename":"/dev/fdset/2","node-name":"libvirt-4-storage","auto-read-only":true,"discard":"unmap"}' \
|
||||
-blockdev '{"node-name":"libvirt-4-format","read-only":false,"driver":"qcow2","file":"libvirt-4-storage"}' \
|
||||
-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x2","drive":"libvirt-4-format","id":"virtio-disk4","bootindex":1}' \
|
||||
--add-fd set=0,fd=704,opaque=libvirt-1-storage0 \
|
||||
--add-fd set=1,fd=777,opaque=libvirt-2-storage0 \
|
||||
--add-fd set=1,fd=778,opaque=libvirt-2-storage1 \
|
||||
-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/rhel7.1484071876","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \
|
||||
-blockdev '{"node-name":"libvirt-3-format","read-only":true,"driver":"qcow2","file":"libvirt-3-storage","backing":null}' \
|
||||
+-add-fd set=1,fd=777,opaque=libvirt-2-storage0 \
|
||||
+-add-fd set=1,fd=778,opaque=libvirt-2-storage1 \
|
||||
-blockdev '{"driver":"file","filename":"/dev/fdset/1","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \
|
||||
-blockdev '{"node-name":"libvirt-2-format","read-only":true,"driver":"qcow2","file":"libvirt-2-storage","backing":"libvirt-3-format"}' \
|
||||
+-add-fd set=0,fd=704,opaque=libvirt-1-storage0 \
|
||||
-blockdev '{"driver":"file","filename":"/dev/fdset/0","node-name":"libvirt-1-storage","read-only":false,"discard":"unmap"}' \
|
||||
-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2","file":"libvirt-1-storage","backing":"libvirt-2-format"}' \
|
||||
-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x3","drive":"libvirt-1-format","id":"virtio-disk5"}' \
|
||||
--
|
||||
2.39.1
|
||||
|
@ -0,0 +1,103 @@
|
||||
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
|
||||
|
@ -0,0 +1,97 @@
|
||||
From f7d193539a8a7194ee3506642b68e0e52619cdf9 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <f7d193539a8a7194ee3506642b68e0e52619cdf9@dist-git>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Tue, 31 Jan 2023 15:25:57 +0100
|
||||
Subject: [PATCH] qemu: fd: Add helpers allowing storing FD set data in status
|
||||
XML
|
||||
|
||||
Rollback of FD sets passed to qemu is also needed after possible restart
|
||||
of libvirtd when we need to serialize the data into status XML. For this
|
||||
purpose we need to access the fdset ID once it was passed to qemu and
|
||||
potentially re-create a 'qemuFDPass' struct in passed state.
|
||||
|
||||
Introduce 'qemuFDPassNewPassed' and 'qemuFDPassIsPassed'.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
(cherry picked from commit 5598c10c6464887a99928de48fb2fc3e4f1696dc)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2040272
|
||||
---
|
||||
src/qemu/qemu_fd.c | 41 +++++++++++++++++++++++++++++++++++++++++
|
||||
src/qemu/qemu_fd.h | 7 +++++++
|
||||
2 files changed, 48 insertions(+)
|
||||
|
||||
diff --git a/src/qemu/qemu_fd.c b/src/qemu/qemu_fd.c
|
||||
index ebeeb65505..f5eedb88ec 100644
|
||||
--- a/src/qemu/qemu_fd.c
|
||||
+++ b/src/qemu/qemu_fd.c
|
||||
@@ -96,6 +96,47 @@ qemuFDPassNew(const char *prefix,
|
||||
}
|
||||
|
||||
|
||||
+/**
|
||||
+ * qemuFDPassNewPassed:
|
||||
+ * @fdSetID: ID of an FDset which was allready passed to qemu
|
||||
+ *
|
||||
+ * Create qemuFDPass pointing to an already passed FD. Useful to usw with
|
||||
+ * qemuFDPassTransferMonitorRollback, when restoring after restart.
|
||||
+ */
|
||||
+qemuFDPass *
|
||||
+qemuFDPassNewPassed(unsigned int fdSetID)
|
||||
+{
|
||||
+ qemuFDPass *fdpass = g_new0(qemuFDPass, 1);
|
||||
+
|
||||
+ fdpass->fdSetID = fdSetID;
|
||||
+ fdpass->passed = true;
|
||||
+
|
||||
+ return fdpass;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * qemuFDPassIsPassed:
|
||||
+ * @fdpass: The fd passing helper struct
|
||||
+ * @id: when non-NULL filled with the fdset ID
|
||||
+ *
|
||||
+ * Returns true if @fdpass was passed to qemu. In such case @id is also filled
|
||||
+ * with the ID of the fdset if non-NULL.
|
||||
+ */
|
||||
+bool
|
||||
+qemuFDPassIsPassed(qemuFDPass *fdpass,
|
||||
+ unsigned *id)
|
||||
+{
|
||||
+ if (!fdpass || !fdpass->passed)
|
||||
+ return false;
|
||||
+
|
||||
+ if (id)
|
||||
+ *id = fdpass->fdSetID;
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/**
|
||||
* qemuFDPassAddFD:
|
||||
* @fdpass: The fd passing helper struct
|
||||
diff --git a/src/qemu/qemu_fd.h b/src/qemu/qemu_fd.h
|
||||
index 032b9442ee..cd0ff2c690 100644
|
||||
--- a/src/qemu/qemu_fd.h
|
||||
+++ b/src/qemu/qemu_fd.h
|
||||
@@ -31,6 +31,13 @@ qemuFDPass *
|
||||
qemuFDPassNew(const char *prefix,
|
||||
void *dompriv);
|
||||
|
||||
+qemuFDPass *
|
||||
+qemuFDPassNewPassed(unsigned int fdSetID);
|
||||
+
|
||||
+bool
|
||||
+qemuFDPassIsPassed(qemuFDPass *fdpass,
|
||||
+ unsigned *id);
|
||||
+
|
||||
void
|
||||
qemuFDPassAddFD(qemuFDPass *fdpass,
|
||||
int *fd,
|
||||
--
|
||||
2.39.1
|
||||
|
@ -0,0 +1,38 @@
|
||||
From d96dc2b87c220298d4de031cff72fd9a458dad74 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <d96dc2b87c220298d4de031cff72fd9a458dad74@dist-git>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Tue, 31 Jan 2023 17:26:43 +0100
|
||||
Subject: [PATCH] qemuFDPassTransferCommand: Mark that FD was passed
|
||||
|
||||
Until now the code didn't expect that we'd want to rollback/detach a FD
|
||||
passed on the commandline, but whith disk backend FD passing this can
|
||||
happen.
|
||||
|
||||
Properly mark the 'qemuFDPass' object as passed to qemu even when it was
|
||||
done on the commandline.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
(cherry picked from commit 3b7b201b95f2facc01bd9f8a42aed0fad96789fa)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2040272
|
||||
---
|
||||
src/qemu/qemu_fd.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/qemu/qemu_fd.c b/src/qemu/qemu_fd.c
|
||||
index 51a8133fde..ebeeb65505 100644
|
||||
--- a/src/qemu/qemu_fd.c
|
||||
+++ b/src/qemu/qemu_fd.c
|
||||
@@ -151,6 +151,8 @@ qemuFDPassTransferCommand(qemuFDPass *fdpass,
|
||||
fdpass->fds[i].fd = -1;
|
||||
virCommandAddArgList(cmd, "-add-fd", arg, NULL);
|
||||
}
|
||||
+
|
||||
+ fdpass->passed = true;
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
2.39.1
|
||||
|
@ -0,0 +1,59 @@
|
||||
From deb6aad4f6bcfd95235d3149e9d69b95fe011294 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <deb6aad4f6bcfd95235d3149e9d69b95fe011294@dist-git>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Tue, 31 Jan 2023 15:19:58 +0100
|
||||
Subject: [PATCH] qemuStorageSourcePrivateDataFormat: Rename 'tmp' to
|
||||
'objectsChildBuf'
|
||||
|
||||
Be consistent with other children buffer variable naming scheme.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
(cherry picked from commit 531adf32743b6045f44964ec5e1f8bdb9c913797)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2040272
|
||||
---
|
||||
src/qemu/qemu_domain.c | 14 +++++++-------
|
||||
1 file changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index 2eb5653254..226d4d6dc1 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -2005,9 +2005,9 @@ static int
|
||||
qemuStorageSourcePrivateDataFormat(virStorageSource *src,
|
||||
virBuffer *buf)
|
||||
{
|
||||
- g_auto(virBuffer) tmp = VIR_BUFFER_INIT_CHILD(buf);
|
||||
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);
|
||||
|
||||
virBufferEscapeString(&nodenamesChildBuf, "<nodename type='storage' name='%s'/>\n", src->nodestorage);
|
||||
virBufferEscapeString(&nodenamesChildBuf, "<nodename type='format' name='%s'/>\n", src->nodeformat);
|
||||
@@ -2025,16 +2025,16 @@ qemuStorageSourcePrivateDataFormat(virStorageSource *src,
|
||||
return -1;
|
||||
|
||||
if (srcPriv) {
|
||||
- qemuStorageSourcePrivateDataFormatSecinfo(&tmp, srcPriv->secinfo, "auth");
|
||||
- qemuStorageSourcePrivateDataFormatSecinfo(&tmp, srcPriv->encinfo, "encryption");
|
||||
- qemuStorageSourcePrivateDataFormatSecinfo(&tmp, srcPriv->httpcookie, "httpcookie");
|
||||
- qemuStorageSourcePrivateDataFormatSecinfo(&tmp, srcPriv->tlsKeySecret, "tlskey");
|
||||
+ qemuStorageSourcePrivateDataFormatSecinfo(&objectsChildBuf, srcPriv->secinfo, "auth");
|
||||
+ qemuStorageSourcePrivateDataFormatSecinfo(&objectsChildBuf, srcPriv->encinfo, "encryption");
|
||||
+ qemuStorageSourcePrivateDataFormatSecinfo(&objectsChildBuf, srcPriv->httpcookie, "httpcookie");
|
||||
+ qemuStorageSourcePrivateDataFormatSecinfo(&objectsChildBuf, srcPriv->tlsKeySecret, "tlskey");
|
||||
}
|
||||
|
||||
if (src->tlsAlias)
|
||||
- virBufferAsprintf(&tmp, "<TLSx509 alias='%s'/>\n", src->tlsAlias);
|
||||
+ virBufferAsprintf(&objectsChildBuf, "<TLSx509 alias='%s'/>\n", src->tlsAlias);
|
||||
|
||||
- virXMLFormatElement(buf, "objects", NULL, &tmp);
|
||||
+ virXMLFormatElement(buf, "objects", NULL, &objectsChildBuf);
|
||||
|
||||
if (src->thresholdEventWithIndex)
|
||||
virBufferAddLit(buf, "<thresholdEvent indexUsed='yes'/>\n");
|
||||
--
|
||||
2.39.1
|
||||
|
@ -0,0 +1,34 @@
|
||||
From bf949f570a232423c7cf01831dfbe7034a4f49d8 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <bf949f570a232423c7cf01831dfbe7034a4f49d8@dist-git>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Tue, 31 Jan 2023 15:23:54 +0100
|
||||
Subject: [PATCH] qemu_fd: Remove declaration for 'qemuFDPassNewDirect'
|
||||
|
||||
The function doesn't exist any more.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
(cherry picked from commit 51dc38fe31beb252cc0fa2780210cdedc698f57f)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2040272
|
||||
---
|
||||
src/qemu/qemu_fd.h | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_fd.h b/src/qemu/qemu_fd.h
|
||||
index 6f165b6be9..032b9442ee 100644
|
||||
--- a/src/qemu/qemu_fd.h
|
||||
+++ b/src/qemu/qemu_fd.h
|
||||
@@ -30,9 +30,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuFDPass, qemuFDPassFree);
|
||||
qemuFDPass *
|
||||
qemuFDPassNew(const char *prefix,
|
||||
void *dompriv);
|
||||
-qemuFDPass *
|
||||
-qemuFDPassNewDirect(const char *prefix,
|
||||
- void *dompriv);
|
||||
|
||||
void
|
||||
qemuFDPassAddFD(qemuFDPass *fdpass,
|
||||
--
|
||||
2.39.1
|
||||
|
@ -0,0 +1,61 @@
|
||||
From a967747fcdf7d78425d218625ddb42606451c2ab Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <a967747fcdf7d78425d218625ddb42606451c2ab@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Wed, 18 Jan 2023 09:03:29 +0100
|
||||
Subject: [PATCH] src: Don't use virReportSystemError() on
|
||||
virProcessGetStatInfo() failure
|
||||
|
||||
Firstly, the virProcessGetStatInfo() does not fail really. But
|
||||
even if it did, it sets correct errno only sometimes (and even
|
||||
that is done in a helper it's calling - virProcessGetStat() and
|
||||
even there it's the case only in very few error paths).
|
||||
|
||||
Therefore, using virReportSystemError() to report errors is very
|
||||
misleading. Use plain virReportError() instead. Luckily, there
|
||||
are only two places where the former was used:
|
||||
chDomainHelperGetVcpus() and qemuDomainHelperGetVcpus() (not a
|
||||
big surprise since CH driver is heavily inspired by QEMU driver).
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
(cherry picked from commit 818c9717c53446ca7abbaa7b3fd7925e1c5ab663)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2148266
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/ch/ch_driver.c | 4 ++--
|
||||
src/qemu/qemu_driver.c | 4 ++--
|
||||
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
|
||||
index db2a66d131..12fbe31c24 100644
|
||||
--- a/src/ch/ch_driver.c
|
||||
+++ b/src/ch/ch_driver.c
|
||||
@@ -1079,8 +1079,8 @@ chDomainHelperGetVcpus(virDomainObj *vm,
|
||||
NULL, NULL,
|
||||
&vcpuinfo->cpu, NULL,
|
||||
vm->pid, vcpupid) < 0) {
|
||||
- virReportSystemError(errno, "%s",
|
||||
- _("cannot get vCPU placement & pCPU time"));
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
+ _("cannot get vCPU placement & pCPU time"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||||
index d6879175fe..c576c601ad 100644
|
||||
--- a/src/qemu/qemu_driver.c
|
||||
+++ b/src/qemu/qemu_driver.c
|
||||
@@ -1355,8 +1355,8 @@ qemuDomainHelperGetVcpus(virDomainObj *vm,
|
||||
NULL, NULL,
|
||||
&vcpuinfo->cpu, NULL,
|
||||
vm->pid, vcpupid) < 0) {
|
||||
- virReportSystemError(errno, "%s",
|
||||
- _("cannot get vCPU placement & pCPU time"));
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
+ _("cannot get vCPU placement & pCPU time"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
--
|
||||
2.39.1
|
||||
|
47
libvirt-virsh-Make-domif-setlink-work-more-than-once.patch
Normal file
47
libvirt-virsh-Make-domif-setlink-work-more-than-once.patch
Normal file
@ -0,0 +1,47 @@
|
||||
From f895d23743a65141a2db7f816e56d18c9c4de6df Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <f895d23743a65141a2db7f816e56d18c9c4de6df@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Mon, 30 Jan 2023 10:55:22 +0100
|
||||
Subject: [PATCH] virsh: Make domif-setlink work more than once
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
In virsh, we have this convenient domif-setlink command, which is
|
||||
just a wrapper over virDomainUpdateDeviceFlags() and which allows
|
||||
setting link state of given guest NIC. It does so by fetching
|
||||
corresponding <interface/> XML snippet and either putting <link
|
||||
state=''/> into it, OR if the element already exists setting the
|
||||
attribute to desired value. The XML is then fed into the update
|
||||
API.
|
||||
|
||||
There's, however, a small bug in detecting the pre-existence of
|
||||
the element and its attribute. The code looks at "link"
|
||||
attribute, while in fact, the attribute is called "state".
|
||||
|
||||
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/426
|
||||
Fixes: e575bf082ed4889280be07c986375f1ca15bb7ee
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 6f3f6c0f763b9ffd8ef93eb124c88dd0b79138fc)
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2165466
|
||||
---
|
||||
tools/virsh-domain.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
|
||||
index 6b431bd1e5..59b2b3ce60 100644
|
||||
--- a/tools/virsh-domain.c
|
||||
+++ b/tools/virsh-domain.c
|
||||
@@ -3209,7 +3209,7 @@ cmdDomIfSetLink(vshControl *ctl, const vshCmd *cmd)
|
||||
}
|
||||
}
|
||||
|
||||
- if (xmlHasProp(linkNode, BAD_CAST "link"))
|
||||
+ if (xmlHasProp(linkNode, BAD_CAST "state"))
|
||||
stateAttr = xmlSetProp(linkNode, BAD_CAST "state", BAD_CAST state);
|
||||
else
|
||||
stateAttr = xmlNewProp(linkNode, BAD_CAST "state", BAD_CAST state);
|
||||
--
|
||||
2.39.1
|
||||
|
24
libvirt.spec
24
libvirt.spec
@ -229,7 +229,7 @@
|
||||
Summary: Library providing a simple virtualization API
|
||||
Name: libvirt
|
||||
Version: 9.0.0
|
||||
Release: 2%{?dist}%{?extra_release}
|
||||
Release: 3%{?dist}%{?extra_release}
|
||||
License: LGPLv2+
|
||||
URL: https://libvirt.org/
|
||||
|
||||
@ -247,6 +247,16 @@ Patch6: libvirt-qemu-hotplug-Remove-legacy-quirk-for-dimm-address-generation.pat
|
||||
Patch7: libvirt-qemu-alias-Remove-oldAlias-argument-of-qemuAssignDeviceMemoryAlias.patch
|
||||
Patch8: libvirt-qemu-Remove-memAliasOrderMismatch-field-from-VM-private-data.patch
|
||||
Patch9: libvirt-rpc-Fix-error-message-in-virNetServerSetClientLimits.patch
|
||||
Patch10: libvirt-src-Don-t-use-virReportSystemError-on-virProcessGetStatInfo-failure.patch
|
||||
Patch11: libvirt-qemu-Provide-virDomainGetCPUStats-implementation-for-session-connection.patch
|
||||
Patch12: libvirt-virsh-Make-domif-setlink-work-more-than-once.patch
|
||||
Patch13: libvirt-qemu_fd-Remove-declaration-for-qemuFDPassNewDirect.patch
|
||||
Patch14: libvirt-qemuStorageSourcePrivateDataFormat-Rename-tmp-to-objectsChildBuf.patch
|
||||
Patch15: libvirt-qemu-command-Handle-FD-passing-commandline-via-qemuBuildBlockStorageSourceAttachDataCommandline.patch
|
||||
Patch16: libvirt-qemuFDPassTransferCommand-Mark-that-FD-was-passed.patch
|
||||
Patch17: libvirt-qemu-fd-Add-helpers-allowing-storing-FD-set-data-in-status-XML.patch
|
||||
Patch18: libvirt-qemu-domain-Store-fdset-ID-for-disks-passed-to-qemu-via-FD.patch
|
||||
Patch19: libvirt-qemu-block-Properly-handle-FD-passed-disk-hot-un-plug.patch
|
||||
|
||||
|
||||
Requires: libvirt-daemon = %{version}-%{release}
|
||||
@ -2337,6 +2347,18 @@ exit 0
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed Feb 1 2023 Jiri Denemark <jdenemar@redhat.com> - 9.0.0-3
|
||||
- src: Don't use virReportSystemError() on virProcessGetStatInfo() failure (rhbz#2148266)
|
||||
- qemu: Provide virDomainGetCPUStats() implementation for session connection (rhbz#2148266)
|
||||
- virsh: Make domif-setlink work more than once (rhbz#2165466)
|
||||
- qemu_fd: Remove declaration for 'qemuFDPassNewDirect' (rhbz#2040272)
|
||||
- qemuStorageSourcePrivateDataFormat: Rename 'tmp' to 'objectsChildBuf' (rhbz#2040272)
|
||||
- qemu: command: Handle FD passing commandline via qemuBuildBlockStorageSourceAttachDataCommandline (rhbz#2040272)
|
||||
- qemuFDPassTransferCommand: Mark that FD was passed (rhbz#2040272)
|
||||
- qemu: fd: Add helpers allowing storing FD set data in status XML (rhbz#2040272)
|
||||
- qemu: domain: Store fdset ID for disks passed to qemu via FD (rhbz#2040272)
|
||||
- qemu: block: Properly handle FD-passed disk hot-(un-)plug (rhbz#2040272)
|
||||
|
||||
* Wed Jan 25 2023 Jiri Denemark <jdenemar@redhat.com> - 9.0.0-2
|
||||
- vircgroupv2: fix cpu.weight limits check (rhbz#2037998)
|
||||
- domain_validate: drop cpu.shares cgroup check (rhbz#2037998)
|
||||
|
Loading…
Reference in New Issue
Block a user