]> xenbits.xensource.com Git - libvirt.git/commitdiff
vircgroupv2: fix setting cpu.max period
authorPavel Hrdina <phrdina@redhat.com>
Thu, 5 Sep 2019 09:22:11 +0000 (11:22 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Fri, 6 Sep 2019 07:24:43 +0000 (09:24 +0200)
When we set cpu.max period we need to parse the cpu.max file first as
it contains both quota and period values separated by space.  When only
a single number is written to that file it will set quota.  However,
in order to change period we need to write both values.

The code was prepared for that but mistakenly used new line to end the
string with the first value.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1749227

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
src/util/vircgroupv2.c

index 2aca4e5d62113e8570d71c236fac19b87110ed5b..0663c671905c6ed93d10fd39b8049748488f8703 100644 (file)
@@ -1508,7 +1508,7 @@ virCgroupV2SetCpuCfsPeriod(virCgroupPtr group,
                        _("Invalid 'cpu.max' data."));
         return -1;
     }
-    *tmp = '\n';
+    *tmp = '\0';
 
     if (virAsprintf(&value, "%s %llu", str, cfs_period) < 0)
         return -1;