render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Pablo Greco 40546a
From 164b5885c6916d39a71a4778da9782c9dc6cadf0 Mon Sep 17 00:00:00 2001
Pablo Greco 40546a
Message-Id: <164b5885c6916d39a71a4778da9782c9dc6cadf0@dist-git>
Pablo Greco 40546a
From: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Date: Fri, 6 Sep 2019 09:29:41 +0200
Pablo Greco 40546a
Subject: [PATCH] vircgroupv2: fix setting cpu.max period
Pablo Greco 40546a
Pablo Greco 40546a
When we set cpu.max period we need to parse the cpu.max file first as
Pablo Greco 40546a
it contains both quota and period values separated by space.  When only
Pablo Greco 40546a
a single number is written to that file it will set quota.  However,
Pablo Greco 40546a
in order to change period we need to write both values.
Pablo Greco 40546a
Pablo Greco 40546a
The code was prepared for that but mistakenly used new line to end the
Pablo Greco 40546a
string with the first value.
Pablo Greco 40546a
Pablo Greco 40546a
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1749227
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Pablo Greco 40546a
(cherry picked from commit 0bd4ad193d8ba7f0104f4739f19f2731e7cf9f56)
Pablo Greco 40546a
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Message-Id: <3a1021b39f7b5add388e98eae4caa63975b60fc3.1567754949.git.phrdina@redhat.com>
Pablo Greco 40546a
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Pablo Greco 40546a
---
Pablo Greco 40546a
 src/util/vircgroupv2.c | 2 +-
Pablo Greco 40546a
 1 file changed, 1 insertion(+), 1 deletion(-)
Pablo Greco 40546a
Pablo Greco 40546a
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
Pablo Greco 40546a
index e7b9093754..13a51e67a4 100644
Pablo Greco 40546a
--- a/src/util/vircgroupv2.c
Pablo Greco 40546a
+++ b/src/util/vircgroupv2.c
Pablo Greco 40546a
@@ -1507,7 +1507,7 @@ virCgroupV2SetCpuCfsPeriod(virCgroupPtr group,
Pablo Greco 40546a
                        _("Invalid 'cpu.max' data."));
Pablo Greco 40546a
         return -1;
Pablo Greco 40546a
     }
Pablo Greco 40546a
-    *tmp = '\n';
Pablo Greco 40546a
+    *tmp = '\0';
Pablo Greco 40546a
 
Pablo Greco 40546a
     if (virAsprintf(&value, "%s %llu", str, cfs_period) < 0)
Pablo Greco 40546a
         return -1;
Pablo Greco 40546a
-- 
Pablo Greco 40546a
2.23.0
Pablo Greco 40546a