libvirt-9.0.0-2.el9

- vircgroupv2: fix cpu.weight limits check (rhbz#2037998)
- domain_validate: drop cpu.shares cgroup check (rhbz#2037998)
- docs: document correct cpu shares limits with both cgroups v1 and v2 (rhbz#2037998)
- qemu_interface: Fix managed='no' case when creating an ethernet interface (rhbz#2144738)
- conf: clarify some external TPM error messages (rhbz#2063723)
- qemu: hotplug: Remove legacy quirk for 'dimm' address generation (rhbz#2158701)
- qemu: alias: Remove 'oldAlias' argument of qemuAssignDeviceMemoryAlias (rhbz#2158701)
- qemu: Remove 'memAliasOrderMismatch' field from VM private data (rhbz#2158701)
- rpc: Fix error message in virNetServerSetClientLimits (rhbz#2033879)

Resolves: rhbz#2033879, rhbz#2037998, rhbz#2063723, rhbz#2144738, rhbz#2158701
This commit is contained in:
Jiri Denemark 2023-01-25 10:13:33 +01:00
parent 04a142d808
commit 86af401d07
10 changed files with 582 additions and 1 deletions

View File

@ -0,0 +1,63 @@
From 0c35c1c0495a953268719ad83cf2f368ab53018b Mon Sep 17 00:00:00 2001
Message-Id: <0c35c1c0495a953268719ad83cf2f368ab53018b@dist-git>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Fri, 20 Jan 2023 12:56:48 +0100
Subject: [PATCH] conf: clarify some external TPM error messages
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Two of the messages referred to 'backend type' when dealing
with the source type and one mentioned the 'client' attribute
from an earlier iteration of the patches, even though the attribute
was later changed to 'connect'.
https://bugzilla.redhat.com/show_bug.cgi?id=2063723
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 1c7476c8797b7f0d6e8d607f6a42c5bf43441677)
Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
src/conf/domain_conf.c | 4 ++--
src/conf/domain_validate.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 45965fa0fa..733399e6da 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10545,7 +10545,7 @@ virDomainTPMDefParseXML(virDomainXMLOption *xmlopt,
case VIR_DOMAIN_TPM_TYPE_EXTERNAL:
if (!(type = virXPathString("string(./backend/source/@type)", ctxt))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
- _("missing external TPM backend type"));
+ _("missing external TPM backend source type"));
goto error;
}
@@ -10555,7 +10555,7 @@ virDomainTPMDefParseXML(virDomainXMLOption *xmlopt,
def->data.external.source->type = virDomainChrTypeFromString(type);
if (def->data.external.source->type < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown backend type '%s' for external TPM"),
+ _("unknown backend source type '%s' for external TPM"),
type);
goto error;
}
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 39d924d4ed..1c13929281 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -2757,7 +2757,7 @@ virDomainTPMDevValidate(const virDomainTPMDef *tpm)
}
if (tpm->data.external.source->data.nix.listen) {
virReportError(VIR_ERR_XML_ERROR, "%s",
- _("only 'client' mode is supported for external TPM device"));
+ _("only 'connect' mode is supported for external TPM device"));
return -1;
}
if (tpm->data.external.source->data.nix.path == NULL) {
--
2.39.1

View File

@ -0,0 +1,53 @@
From 31f2edcd7f42cda4173eabad879bfc318c202c9e Mon Sep 17 00:00:00 2001
Message-Id: <31f2edcd7f42cda4173eabad879bfc318c202c9e@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 17 Jan 2023 10:33:22 +0100
Subject: [PATCH] docs: document correct cpu shares limits with both cgroups v1
and v2
The limits are different with cgroups v1 and v2 but our XML
documentation and virsh manpage mentioned only cgroups v1 limits without
explicitly saying it only applies to cgroups v1.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit ead6e1b00285cbd98e0f0727efb8adcb29ebc1ba)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2037998
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
docs/formatdomain.rst | 2 +-
docs/manpages/virsh.rst | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 490a954745..8fc8aeb928 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -849,7 +849,7 @@ CPU Tuning
There is no unit for the value, it's a relative measure based on the setting
of other VM, e.g. A VM configured with value 2048 will get twice as much CPU
time as a VM configured with value 1024. The value should be in range
- [2, 262144]. :since:`Since 0.9.0`
+ [2, 262144] using cgroups v1, [1, 10000] using cgroups v2. :since:`Since 0.9.0`
``period``
The optional ``period`` element specifies the enforcement interval (unit:
microseconds). Within ``period``, each vCPU of the domain will not be allowed
diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 88b7fa1da8..d5b614dc03 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -4054,7 +4054,8 @@ If *--config* is specified, affect the next start of a persistent guest.
If *--current* is specified, it is equivalent to either *--live* or
*--config*, depending on the current state of the guest.
-``Note``: The cpu_shares parameter has a valid value range of 2-262144.
+``Note``: The cpu_shares parameter has a valid value range of 2-262144
+with cgroups v1, 1-10000 with cgroups v2.
``Note``: The weight and cap parameters are defined only for the
XEN_CREDIT scheduler.
--
2.39.1

View File

@ -0,0 +1,50 @@
From fbf5f9bce43e19f8827e5cdef0e456b74ccc2f7d Mon Sep 17 00:00:00 2001
Message-Id: <fbf5f9bce43e19f8827e5cdef0e456b74ccc2f7d@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 17 Jan 2023 10:08:08 +0100
Subject: [PATCH] domain_validate: drop cpu.shares cgroup check
This check is done when VM is defined but doesn't take into account what
cgroups version is currently used on the host system so it doesn't work
correctly.
To make proper check at this point we would have to figure out cgroups
version while defining a VM but that will still not guarantee that the
VM will start correctly in the future as the host may be rebooted with
different cgroups version.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 38af6497610075e5fe386734b87186731d4c17ac)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2037998
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
src/conf/domain_validate.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 5a9bf20d3f..39d924d4ed 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -1725,16 +1725,6 @@ virDomainDefOSValidate(const virDomainDef *def,
static int
virDomainDefCputuneValidate(const virDomainDef *def)
{
- if (def->cputune.shares > 0 &&
- (def->cputune.shares < VIR_CGROUP_CPU_SHARES_MIN ||
- def->cputune.shares > VIR_CGROUP_CPU_SHARES_MAX)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Value of cputune 'shares' must be in range [%llu, %llu]"),
- VIR_CGROUP_CPU_SHARES_MIN,
- VIR_CGROUP_CPU_SHARES_MAX);
- return -1;
- }
-
CPUTUNE_VALIDATE_PERIOD(period);
CPUTUNE_VALIDATE_PERIOD(global_period);
CPUTUNE_VALIDATE_PERIOD(emulator_period);
--
2.39.1

View File

@ -0,0 +1,77 @@
From e0e6c7375855e09c45591d0b5ab23cddaa230ad8 Mon Sep 17 00:00:00 2001
Message-Id: <e0e6c7375855e09c45591d0b5ab23cddaa230ad8@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 19 Jan 2023 15:18:45 +0100
Subject: [PATCH] qemu: Remove 'memAliasOrderMismatch' field from VM private
data
The field is no longer used so we can remove it and the code filling it.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 5764930463eb8f450e45fa982651ef6b7a7afd7c)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2158701
---
src/qemu/qemu_domain.h | 3 ---
src/qemu/qemu_process.c | 24 ------------------------
2 files changed, 27 deletions(-)
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 08430b67b9..eca5404cdc 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -177,9 +177,6 @@ struct _qemuDomainObjPrivate {
uint8_t *masterKey;
size_t masterKeyLen;
- /* note whether memory device alias does not correspond to slot number */
- bool memAliasOrderMismatch;
-
/* for migrations using TLS with a secret (not to be saved in our */
/* private XML). */
qemuDomainSecretInfo *migSecinfo;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ee9f0784d3..29716ecb19 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3896,28 +3896,6 @@ qemuDomainPerfRestart(virDomainObj *vm)
}
-static void
-qemuProcessReconnectCheckMemAliasOrderMismatch(virDomainObj *vm)
-{
- size_t i;
- int aliasidx;
- virDomainDef *def = vm->def;
- qemuDomainObjPrivate *priv = vm->privateData;
-
- if (!virDomainDefHasMemoryHotplug(def) || def->nmems == 0)
- return;
-
- for (i = 0; i < def->nmems; i++) {
- aliasidx = qemuDomainDeviceAliasIndex(&def->mems[i]->info, "dimm");
-
- if (def->mems[i]->info.addr.dimm.slot != aliasidx) {
- priv->memAliasOrderMismatch = true;
- break;
- }
- }
-}
-
-
static bool
qemuProcessDomainMemoryDefNeedHugepagesPath(const virDomainMemoryDef *mem,
const long system_pagesize)
@@ -9091,8 +9069,6 @@ qemuProcessReconnect(void *opaque)
if (qemuProcessRefreshFdsetIndex(obj) < 0)
goto error;
- qemuProcessReconnectCheckMemAliasOrderMismatch(obj);
-
if (qemuConnectAgent(driver, obj) < 0)
goto error;
--
2.39.1

View File

@ -0,0 +1,108 @@
From 9271efe525e9cfaf1aad931ffccf61d6d17e5273 Mon Sep 17 00:00:00 2001
Message-Id: <9271efe525e9cfaf1aad931ffccf61d6d17e5273@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 19 Jan 2023 15:16:58 +0100
Subject: [PATCH] qemu: alias: Remove 'oldAlias' argument of
qemuAssignDeviceMemoryAlias
All callers pass 'false' so we no longer need it.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 6d3f0b11b2b056313b123510c96f2924689341f9)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2158701
---
src/qemu/qemu_alias.c | 13 ++++---------
src/qemu/qemu_alias.h | 3 +--
src/qemu/qemu_hotplug.c | 2 +-
3 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
index ef8e87ab58..0f1310a0e5 100644
--- a/src/qemu/qemu_alias.c
+++ b/src/qemu/qemu_alias.c
@@ -454,7 +454,6 @@ qemuAssignDeviceRNGAlias(virDomainDef *def,
static int
qemuDeviceMemoryGetAliasID(virDomainDef *def,
virDomainMemoryDef *mem,
- bool oldAlias,
const char *prefix)
{
size_t i;
@@ -462,8 +461,7 @@ qemuDeviceMemoryGetAliasID(virDomainDef *def,
/* virtio-pmem and virtio-mem go onto PCI bus and thus DIMM address is not
* valid */
- if (!oldAlias &&
- mem->model != VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM &&
+ if (mem->model != VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM &&
mem->model != VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM &&
mem->model != VIR_DOMAIN_MEMORY_MODEL_SGX_EPC)
return mem->info.addr.dimm.slot;
@@ -482,8 +480,6 @@ qemuDeviceMemoryGetAliasID(virDomainDef *def,
* qemuAssignDeviceMemoryAlias:
* @def: domain definition. Necessary only if @oldAlias is true.
* @mem: memory device definition
- * @oldAlias: Generate the alias according to the order of the device in @def
- * rather than according to the slot number for legacy reasons.
*
* Generates alias for a memory device according to slot number if @oldAlias is
* false or according to order in @def->mems otherwise.
@@ -492,8 +488,7 @@ qemuDeviceMemoryGetAliasID(virDomainDef *def,
*/
int
qemuAssignDeviceMemoryAlias(virDomainDef *def,
- virDomainMemoryDef *mem,
- bool oldAlias)
+ virDomainMemoryDef *mem)
{
const char *prefix = NULL;
int idx = 0;
@@ -525,7 +520,7 @@ qemuAssignDeviceMemoryAlias(virDomainDef *def,
break;
}
- idx = qemuDeviceMemoryGetAliasID(def, mem, oldAlias, prefix);
+ idx = qemuDeviceMemoryGetAliasID(def, mem, prefix);
mem->info.alias = g_strdup_printf("%s%d", prefix, idx);
return 0;
@@ -685,7 +680,7 @@ qemuAssignDeviceAliases(virDomainDef *def)
qemuAssignDeviceTPMAlias(def->tpms[i], i);
}
for (i = 0; i < def->nmems; i++) {
- if (qemuAssignDeviceMemoryAlias(def, def->mems[i], false) < 0)
+ if (qemuAssignDeviceMemoryAlias(def, def->mems[i]) < 0)
return -1;
}
if (def->vsock) {
diff --git a/src/qemu/qemu_alias.h b/src/qemu/qemu_alias.h
index 6433ae4cec..af9c3f62d3 100644
--- a/src/qemu/qemu_alias.h
+++ b/src/qemu/qemu_alias.h
@@ -55,8 +55,7 @@ void qemuAssignDeviceRNGAlias(virDomainDef *def,
virDomainRNGDef *rng);
int qemuAssignDeviceMemoryAlias(virDomainDef *def,
- virDomainMemoryDef *mems,
- bool oldAlias);
+ virDomainMemoryDef *mems);
void qemuAssignDeviceShmemAlias(virDomainDef *def,
virDomainShmemDef *shmem,
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 5840504d13..2df59873db 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2275,7 +2275,7 @@ qemuDomainAttachMemory(virQEMUDriver *driver,
goto cleanup;
releaseaddr = true;
- if (qemuAssignDeviceMemoryAlias(vm->def, mem, false) < 0)
+ if (qemuAssignDeviceMemoryAlias(vm->def, mem) < 0)
goto cleanup;
objalias = g_strdup_printf("mem%s", mem->info.alias);
--
2.39.1

View File

@ -0,0 +1,51 @@
From b6eb914119af7e724cbee27951cfba0a6afb3b97 Mon Sep 17 00:00:00 2001
Message-Id: <b6eb914119af7e724cbee27951cfba0a6afb3b97@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 19 Jan 2023 15:06:11 +0100
Subject: [PATCH] qemu: hotplug: Remove legacy quirk for 'dimm' address
generation
Commit b7798a07f93 (in fall of 2016) changed the way we generate aliases
for 'dimm' memory devices as the alias itself is part of the migration
stream section naming and thus must be treated as ABI.
The code added compatibility layer for VMs with memory hotplug started
with the old scheme to prevent from generating wrong aliases. The
compatibility layer broke though later when 'nvdimm' and 'pmem' devices
were introduced as it wrongly detected them as old configuration.
Now rather than attempting to fix the legacy compat layer to treat other
devices properly we'll be better off simply removing it as it's
extremely unlikely that somebody has a VM started in 2016 running with
today's libvirt and attempts to hotplug more memory.
This fixes a corner case when a user hot-adds a 'dimm' into a VM with a
'dimm' and a 'nvdimm' after restart of libvirtd and then attempts to
migrate the VM.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2158701
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 50ce3463d514950350143f03e8421c8c31889c5d)
---
src/qemu/qemu_hotplug.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 026e1ee5ad..5840504d13 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2275,9 +2275,7 @@ qemuDomainAttachMemory(virQEMUDriver *driver,
goto cleanup;
releaseaddr = true;
- /* in cases where we are using a VM with aliases generated according to the
- * index of the memory device we need to keep continue using that scheme */
- if (qemuAssignDeviceMemoryAlias(vm->def, mem, priv->memAliasOrderMismatch) < 0)
+ if (qemuAssignDeviceMemoryAlias(vm->def, mem, false) < 0)
goto cleanup;
objalias = g_strdup_printf("mem%s", mem->info.alias);
--
2.39.1

View File

@ -0,0 +1,56 @@
From 25de0ead0194159a6d9a769f34ec5b092e9b718c Mon Sep 17 00:00:00 2001
Message-Id: <25de0ead0194159a6d9a769f34ec5b092e9b718c@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 23 Jan 2023 11:42:18 +0100
Subject: [PATCH] qemu_interface: Fix managed='no' case when creating an
ethernet interface
In a recent commit of v9.0.0-rc1~192 I've tried to forbid case
where a TAP device already exists, but at the same time it's
managed by Libvirt (<interface type='ethernet'> <target
dev='tap0' managed='yes'/> </interface>). NB, if @managed
attribute is missing then it's assumed to be managed by Libvirt.
Anyway, I've mistakenly put setting of
VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING flag into managed='yes'
branch instead of managed='no' branch in
qemuInterfaceEthernetConnect().
Move the setting of the flag into the correct branch.
Fixes: a2ae3d299cf9c5ada8aa42ec4271748eb479dc27
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit d6a8b9eef70887e01fa5fd292580e14ca5eab08c)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2144738
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_interface.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c
index b6895cedde..ed2c209167 100644
--- a/src/qemu/qemu_interface.c
+++ b/src/qemu/qemu_interface.c
@@ -443,6 +443,9 @@ qemuInterfaceEthernetConnect(virDomainDef *def,
_("target managed='no' but specified dev doesn't exist"));
goto cleanup;
}
+
+ tap_create_flags |= VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING;
+
if (virNetDevMacVLanIsMacvtap(net->ifname)) {
auditdev = net->ifname;
if (virNetDevMacVLanTapOpen(net->ifname, tapfd, tapfdSize) < 0)
@@ -461,8 +464,6 @@ qemuInterfaceEthernetConnect(virDomainDef *def,
if (!net->ifname)
template_ifname = true;
- tap_create_flags |= VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING;
-
if (virNetDevTapCreate(&net->ifname, tunpath, tapfd, tapfdSize,
tap_create_flags) < 0) {
goto cleanup;
--
2.39.1

View File

@ -0,0 +1,43 @@
From f26e30ecb3d0e25d5cf648755e2b4e1db0476b52 Mon Sep 17 00:00:00 2001
Message-Id: <f26e30ecb3d0e25d5cf648755e2b4e1db0476b52@dist-git>
From: Martin Kletzander <mkletzan@redhat.com>
Date: Tue, 24 Jan 2023 13:45:09 +0100
Subject: [PATCH] rpc: Fix error message in virNetServerSetClientLimits
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Commit f007940cb25a tried to change the error message so that it is unified
later in 35afa1d2d6c1, but various rewrites missed this particular error message
which does not make sense. Fix it so that it is the same as the other two
messages checking the same thing in this file.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2033879
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 1e2605c934b80c3e9c30e929834d38fee86f184e)
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
---
src/rpc/virnetserver.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index bf0fda04ee..e97dfe8136 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -1127,9 +1127,8 @@ virNetServerSetClientLimits(virNetServer *srv,
if (max < max_unauth) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
- _("The overall maximum number of clients waiting "
- "for authentication must not be less than the overall "
- "maximum number of clients"));
+ _("The overall maximum number of clients must not be less "
+ "than the number of clients waiting for authentication"));
return -1;
}
--
2.39.1

View File

@ -0,0 +1,59 @@
From 28bd414db666463dca0a26bbb969fd6bc784ec8e Mon Sep 17 00:00:00 2001
Message-Id: <28bd414db666463dca0a26bbb969fd6bc784ec8e@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 17 Jan 2023 10:02:07 +0100
Subject: [PATCH] vircgroupv2: fix cpu.weight limits check
The cgroup v2 cpu.weight limits are different than cgroup v1 cpu.shares
limits.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit cf3414a85b8383d71d6ae2a53daf63c331cc2230)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2037998
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
src/util/vircgroup.h | 2 ++
src/util/vircgroupv2.c | 8 ++++----
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h
index 690f09465c..adf3850b22 100644
--- a/src/util/vircgroup.h
+++ b/src/util/vircgroup.h
@@ -235,6 +235,8 @@ int virCgroupGetCpuShares(virCgroup *group, unsigned long long *shares);
/* Based on kernel code ((1ULL << MAX_BW_BITS) - 1) where MAX_BW_BITS is
* (64 - BW_SHIFT) and BW_SHIFT is 20 */
#define VIR_CGROUP_CPU_QUOTA_MAX 17592186044415LL
+#define VIR_CGROUPV2_WEIGHT_MIN 1LL
+#define VIR_CGROUPV2_WEIGHT_MAX 10000LL
int virCgroupSetCpuCfsPeriod(virCgroup *group, unsigned long long cfs_period);
int virCgroupGetCpuCfsPeriod(virCgroup *group, unsigned long long *cfs_period);
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index b1f562aa52..219b9c7f21 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -1499,13 +1499,13 @@ static int
virCgroupV2SetCpuShares(virCgroup *group,
unsigned long long shares)
{
- if (shares < VIR_CGROUP_CPU_SHARES_MIN ||
- shares > VIR_CGROUP_CPU_SHARES_MAX) {
+ if (shares < VIR_CGROUPV2_WEIGHT_MIN ||
+ shares > VIR_CGROUPV2_WEIGHT_MAX) {
virReportError(VIR_ERR_INVALID_ARG,
_("shares '%llu' must be in range [%llu, %llu]"),
shares,
- VIR_CGROUP_CPU_SHARES_MIN,
- VIR_CGROUP_CPU_SHARES_MAX);
+ VIR_CGROUPV2_WEIGHT_MIN,
+ VIR_CGROUPV2_WEIGHT_MAX);
return -1;
}
--
2.39.1

View File

@ -229,7 +229,7 @@
Summary: Library providing a simple virtualization API
Name: libvirt
Version: 9.0.0
Release: 1%{?dist}%{?extra_release}
Release: 2%{?dist}%{?extra_release}
License: LGPLv2+
URL: https://libvirt.org/
@ -238,6 +238,16 @@ URL: https://libvirt.org/
%endif
Source: https://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.xz
Source1: symlinks
Patch1: libvirt-vircgroupv2-fix-cpu.weight-limits-check.patch
Patch2: libvirt-domain_validate-drop-cpu.shares-cgroup-check.patch
Patch3: libvirt-docs-document-correct-cpu-shares-limits-with-both-cgroups-v1-and-v2.patch
Patch4: libvirt-qemu_interface-Fix-managed-no-case-when-creating-an-ethernet-interface.patch
Patch5: libvirt-conf-clarify-some-external-TPM-error-messages.patch
Patch6: libvirt-qemu-hotplug-Remove-legacy-quirk-for-dimm-address-generation.patch
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
Requires: libvirt-daemon = %{version}-%{release}
Requires: libvirt-daemon-config-network = %{version}-%{release}
@ -2327,6 +2337,17 @@ exit 0
%endif
%changelog
* 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)
- docs: document correct cpu shares limits with both cgroups v1 and v2 (rhbz#2037998)
- qemu_interface: Fix managed='no' case when creating an ethernet interface (rhbz#2144738)
- conf: clarify some external TPM error messages (rhbz#2063723)
- qemu: hotplug: Remove legacy quirk for 'dimm' address generation (rhbz#2158701)
- qemu: alias: Remove 'oldAlias' argument of qemuAssignDeviceMemoryAlias (rhbz#2158701)
- qemu: Remove 'memAliasOrderMismatch' field from VM private data (rhbz#2158701)
- rpc: Fix error message in virNetServerSetClientLimits (rhbz#2033879)
* Mon Jan 16 2023 Jiri Denemark <jdenemar@redhat.com> - 9.0.0-1
- Rebased to libvirt-9.0.0 (rhbz#2124466)
- The rebase also fixes the following bugs: