|
|
7a3408 |
From 5055589798e9317ae3d9772d5a774c2578c89a3d Mon Sep 17 00:00:00 2001
|
|
|
7a3408 |
Message-Id: <5055589798e9317ae3d9772d5a774c2578c89a3d@dist-git>
|
|
|
7a3408 |
From: Martin Kletzander <mkletzan@redhat.com>
|
|
|
7a3408 |
Date: Tue, 18 Aug 2015 17:28:01 -0700
|
|
|
7a3408 |
Subject: [PATCH] lxc: Sync BlkioDevice values when setting them in cgroups
|
|
|
7a3408 |
|
|
|
7a3408 |
https://bugzilla.redhat.com/show_bug.cgi?id=1165580
|
|
|
7a3408 |
|
|
|
7a3408 |
The problem here is that there are some values that kernel accepts, but
|
|
|
7a3408 |
does not set them, for example 18446744073709551615 which acts the same
|
|
|
7a3408 |
way as zero. Let's do the same thing we do with other tuning options
|
|
|
7a3408 |
and re-read them right after they are set in order to keep our internal
|
|
|
7a3408 |
structures up-to-date.
|
|
|
7a3408 |
|
|
|
7a3408 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
7a3408 |
(cherry picked from commit 4563c59b5b40f40f90c0579f5e2fcdd29c414265)
|
|
|
7a3408 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
7a3408 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
7a3408 |
---
|
|
|
7a3408 |
src/lxc/lxc_cgroup.c | 20 +++++++++++++++-----
|
|
|
7a3408 |
src/lxc/lxc_driver.c | 25 ++++++++++++++++++++-----
|
|
|
7a3408 |
2 files changed, 35 insertions(+), 10 deletions(-)
|
|
|
7a3408 |
|
|
|
7a3408 |
diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
|
|
|
7a3408 |
index e9caa3e..ad254e4 100644
|
|
|
7a3408 |
--- a/src/lxc/lxc_cgroup.c
|
|
|
7a3408 |
+++ b/src/lxc/lxc_cgroup.c
|
|
|
7a3408 |
@@ -117,27 +117,37 @@ static int virLXCCgroupSetupBlkioTune(virDomainDefPtr def,
|
|
|
7a3408 |
|
|
|
7a3408 |
if (dev->weight &&
|
|
|
7a3408 |
(virCgroupSetBlkioDeviceWeight(cgroup, dev->path,
|
|
|
7a3408 |
- dev->weight) < 0))
|
|
|
7a3408 |
+ dev->weight) < 0 ||
|
|
|
7a3408 |
+ virCgroupGetBlkioDeviceWeight(cgroup, dev->path,
|
|
|
7a3408 |
+ &dev->weight) < 0))
|
|
|
7a3408 |
return -1;
|
|
|
7a3408 |
|
|
|
7a3408 |
if (dev->riops &&
|
|
|
7a3408 |
(virCgroupSetBlkioDeviceReadIops(cgroup, dev->path,
|
|
|
7a3408 |
- dev->riops) < 0))
|
|
|
7a3408 |
+ dev->riops) < 0 ||
|
|
|
7a3408 |
+ virCgroupGetBlkioDeviceReadIops(cgroup, dev->path,
|
|
|
7a3408 |
+ &dev->riops) < 0))
|
|
|
7a3408 |
return -1;
|
|
|
7a3408 |
|
|
|
7a3408 |
if (dev->wiops &&
|
|
|
7a3408 |
(virCgroupSetBlkioDeviceWriteIops(cgroup, dev->path,
|
|
|
7a3408 |
- dev->wiops) < 0))
|
|
|
7a3408 |
+ dev->wiops) < 0 ||
|
|
|
7a3408 |
+ virCgroupGetBlkioDeviceWriteIops(cgroup, dev->path,
|
|
|
7a3408 |
+ &dev->wiops) < 0))
|
|
|
7a3408 |
return -1;
|
|
|
7a3408 |
|
|
|
7a3408 |
if (dev->rbps &&
|
|
|
7a3408 |
(virCgroupSetBlkioDeviceReadBps(cgroup, dev->path,
|
|
|
7a3408 |
- dev->rbps) < 0))
|
|
|
7a3408 |
+ dev->rbps) < 0 ||
|
|
|
7a3408 |
+ virCgroupGetBlkioDeviceReadBps(cgroup, dev->path,
|
|
|
7a3408 |
+ &dev->rbps) < 0))
|
|
|
7a3408 |
return -1;
|
|
|
7a3408 |
|
|
|
7a3408 |
if (dev->wbps &&
|
|
|
7a3408 |
(virCgroupSetBlkioDeviceWriteBps(cgroup, dev->path,
|
|
|
7a3408 |
- dev->wbps) < 0))
|
|
|
7a3408 |
+ dev->wbps) < 0 ||
|
|
|
7a3408 |
+ virCgroupGetBlkioDeviceWriteBps(cgroup, dev->path,
|
|
|
7a3408 |
+ &dev->wbps) < 0))
|
|
|
7a3408 |
return -1;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
}
|
|
|
7a3408 |
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
|
|
|
7a3408 |
index d8d5119..1a7cc78 100644
|
|
|
7a3408 |
--- a/src/lxc/lxc_driver.c
|
|
|
7a3408 |
+++ b/src/lxc/lxc_driver.c
|
|
|
7a3408 |
@@ -2603,7 +2603,10 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
|
|
|
7a3408 |
for (j = 0; j < ndevices; j++) {
|
|
|
7a3408 |
if (virCgroupSetBlkioDeviceWeight(priv->cgroup,
|
|
|
7a3408 |
devices[j].path,
|
|
|
7a3408 |
- devices[j].weight) < 0) {
|
|
|
7a3408 |
+ devices[j].weight) < 0 ||
|
|
|
7a3408 |
+ virCgroupGetBlkioDeviceWeight(priv->cgroup,
|
|
|
7a3408 |
+ devices[j].path,
|
|
|
7a3408 |
+ &devices[j].weight) < 0) {
|
|
|
7a3408 |
ret = -1;
|
|
|
7a3408 |
break;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
@@ -2612,7 +2615,10 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
|
|
|
7a3408 |
for (j = 0; j < ndevices; j++) {
|
|
|
7a3408 |
if (virCgroupSetBlkioDeviceReadIops(priv->cgroup,
|
|
|
7a3408 |
devices[j].path,
|
|
|
7a3408 |
- devices[j].riops) < 0) {
|
|
|
7a3408 |
+ devices[j].riops) < 0 ||
|
|
|
7a3408 |
+ virCgroupGetBlkioDeviceReadIops(priv->cgroup,
|
|
|
7a3408 |
+ devices[j].path,
|
|
|
7a3408 |
+ &devices[j].riops) < 0) {
|
|
|
7a3408 |
ret = -1;
|
|
|
7a3408 |
break;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
@@ -2621,7 +2627,10 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
|
|
|
7a3408 |
for (j = 0; j < ndevices; j++) {
|
|
|
7a3408 |
if (virCgroupSetBlkioDeviceWriteIops(priv->cgroup,
|
|
|
7a3408 |
devices[j].path,
|
|
|
7a3408 |
- devices[j].wiops) < 0) {
|
|
|
7a3408 |
+ devices[j].wiops) < 0 ||
|
|
|
7a3408 |
+ virCgroupGetBlkioDeviceWriteIops(priv->cgroup,
|
|
|
7a3408 |
+ devices[j].path,
|
|
|
7a3408 |
+ &devices[j].wiops) < 0) {
|
|
|
7a3408 |
ret = -1;
|
|
|
7a3408 |
break;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
@@ -2630,7 +2639,10 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
|
|
|
7a3408 |
for (j = 0; j < ndevices; j++) {
|
|
|
7a3408 |
if (virCgroupSetBlkioDeviceReadBps(priv->cgroup,
|
|
|
7a3408 |
devices[j].path,
|
|
|
7a3408 |
- devices[j].rbps) < 0) {
|
|
|
7a3408 |
+ devices[j].rbps) < 0 ||
|
|
|
7a3408 |
+ virCgroupGetBlkioDeviceReadBps(priv->cgroup,
|
|
|
7a3408 |
+ devices[j].path,
|
|
|
7a3408 |
+ &devices[j].rbps) < 0) {
|
|
|
7a3408 |
ret = -1;
|
|
|
7a3408 |
break;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
@@ -2639,7 +2651,10 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
|
|
|
7a3408 |
for (j = 0; j < ndevices; j++) {
|
|
|
7a3408 |
if (virCgroupSetBlkioDeviceWriteBps(priv->cgroup,
|
|
|
7a3408 |
devices[j].path,
|
|
|
7a3408 |
- devices[j].wbps) < 0) {
|
|
|
7a3408 |
+ devices[j].wbps) < 0 ||
|
|
|
7a3408 |
+ virCgroupGetBlkioDeviceWriteBps(priv->cgroup,
|
|
|
7a3408 |
+ devices[j].path,
|
|
|
7a3408 |
+ &devices[j].wbps) < 0) {
|
|
|
7a3408 |
ret = -1;
|
|
|
7a3408 |
break;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
--
|
|
|
7a3408 |
2.5.1
|
|
|
7a3408 |
|