render / rpms / libvirt

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