|
Pablo Greco |
40546a |
From e3b6a0736a5b8e23041006ac004cccf1e48ae528 Mon Sep 17 00:00:00 2001
|
|
Pablo Greco |
40546a |
Message-Id: <e3b6a0736a5b8e23041006ac004cccf1e48ae528@dist-git>
|
|
Pablo Greco |
40546a |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
Date: Mon, 1 Jul 2019 17:06:20 +0200
|
|
Pablo Greco |
40546a |
Subject: [PATCH] vircgrouptest: call virCgroupNewSelf instead
|
|
Pablo Greco |
40546a |
virCgroupDetectMounts
|
|
Pablo Greco |
40546a |
MIME-Version: 1.0
|
|
Pablo Greco |
40546a |
Content-Type: text/plain; charset=UTF-8
|
|
Pablo Greco |
40546a |
Content-Transfer-Encoding: 8bit
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
This will be required once cgroup v2 is introduced. The cgroup
|
|
Pablo Greco |
40546a |
detection is not simple and we will have multiple backends so we
|
|
Pablo Greco |
40546a |
should not just jump into the middle of the detection code.
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
In order to use virCgroupNewSelf we need to create all the remaining
|
|
Pablo Greco |
40546a |
data files:
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
- {name}.cgroups represents /proc/cgroups, it is a list of cgroup
|
|
Pablo Greco |
40546a |
controllers compiled into kernel
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
- {name}.self.cgroup represents /proc/self/cgroup, it describes
|
|
Pablo Greco |
40546a |
cgroups to which the process belongs
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
For "no-cgroups" we need to modify the expected behavior because
|
|
Pablo Greco |
40546a |
virCgroupNewSelf() will fail if there are no controllers available.
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
(cherry picked from commit 8b62008d2bc5442f7755e579ea754ffd5e3f9691)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
Message-Id: <3d1ddcca1a1e323e607445c5d1089698122efdd8.1561993099.git.phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
---
|
|
Pablo Greco |
40546a |
src/libvirt_private.syms | 1 -
|
|
Pablo Greco |
40546a |
src/util/vircgroup.c | 11 +------
|
|
Pablo Greco |
40546a |
src/util/vircgrouppriv.h | 2 --
|
|
Pablo Greco |
40546a |
tests/vircgroupdata/cgroups1.cgroups | 11 +++++++
|
|
Pablo Greco |
40546a |
tests/vircgroupdata/cgroups1.self.cgroup | 11 +++++++
|
|
Pablo Greco |
40546a |
tests/vircgroupdata/cgroups2.cgroups | 10 +++++++
|
|
Pablo Greco |
40546a |
tests/vircgroupdata/cgroups2.self.cgroup | 10 +++++++
|
|
Pablo Greco |
40546a |
tests/vircgroupdata/cgroups3.cgroups | 12 ++++++++
|
|
Pablo Greco |
40546a |
tests/vircgroupdata/cgroups3.self.cgroup | 12 ++++++++
|
|
Pablo Greco |
40546a |
tests/vircgroupdata/fedora-18.cgroups | 10 +++++++
|
|
Pablo Greco |
40546a |
tests/vircgroupdata/fedora-18.self.cgroup | 9 ++++++
|
|
Pablo Greco |
40546a |
tests/vircgroupdata/fedora-21.cgroups | 12 ++++++++
|
|
Pablo Greco |
40546a |
tests/vircgroupdata/fedora-21.self.cgroup | 10 +++++++
|
|
Pablo Greco |
40546a |
tests/vircgroupdata/kubevirt.cgroups | 10 +++++++
|
|
Pablo Greco |
40546a |
tests/vircgroupdata/kubevirt.self.cgroup | 10 +++++++
|
|
Pablo Greco |
40546a |
tests/vircgroupdata/no-cgroups.cgroups | 8 +++++
|
|
Pablo Greco |
40546a |
tests/vircgroupdata/no-cgroups.parsed | 10 -------
|
|
Pablo Greco |
40546a |
tests/vircgroupdata/no-cgroups.self.cgroup | 0
|
|
Pablo Greco |
40546a |
tests/vircgroupdata/ovirt-node-6.6.cgroups | 9 ++++++
|
|
Pablo Greco |
40546a |
.../vircgroupdata/ovirt-node-6.6.self.cgroup | 8 +++++
|
|
Pablo Greco |
40546a |
tests/vircgroupdata/ovirt-node-7.1.cgroups | 11 +++++++
|
|
Pablo Greco |
40546a |
.../vircgroupdata/ovirt-node-7.1.self.cgroup | 10 +++++++
|
|
Pablo Greco |
40546a |
tests/vircgroupdata/rhel-7.1.cgroups | 11 +++++++
|
|
Pablo Greco |
40546a |
tests/vircgroupdata/rhel-7.1.self.cgroup | 10 +++++++
|
|
Pablo Greco |
40546a |
tests/vircgrouptest.c | 30 ++++++++++++++-----
|
|
Pablo Greco |
40546a |
25 files changed, 217 insertions(+), 31 deletions(-)
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/cgroups1.cgroups
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/cgroups1.self.cgroup
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/cgroups2.cgroups
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/cgroups2.self.cgroup
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/cgroups3.cgroups
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/cgroups3.self.cgroup
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/fedora-18.cgroups
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/fedora-18.self.cgroup
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/fedora-21.cgroups
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/fedora-21.self.cgroup
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/kubevirt.cgroups
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/kubevirt.self.cgroup
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/no-cgroups.cgroups
|
|
Pablo Greco |
40546a |
delete mode 100644 tests/vircgroupdata/no-cgroups.parsed
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/no-cgroups.self.cgroup
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/ovirt-node-6.6.cgroups
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/ovirt-node-6.6.self.cgroup
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/ovirt-node-7.1.cgroups
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/ovirt-node-7.1.self.cgroup
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/rhel-7.1.cgroups
|
|
Pablo Greco |
40546a |
create mode 100644 tests/vircgroupdata/rhel-7.1.self.cgroup
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
|
Pablo Greco |
40546a |
index b66beb7f91..8c4be84fd5 100644
|
|
Pablo Greco |
40546a |
--- a/src/libvirt_private.syms
|
|
Pablo Greco |
40546a |
+++ b/src/libvirt_private.syms
|
|
Pablo Greco |
40546a |
@@ -1528,7 +1528,6 @@ virCgroupDelThread;
|
|
Pablo Greco |
40546a |
virCgroupDenyAllDevices;
|
|
Pablo Greco |
40546a |
virCgroupDenyDevice;
|
|
Pablo Greco |
40546a |
virCgroupDenyDevicePath;
|
|
Pablo Greco |
40546a |
-virCgroupDetectMounts;
|
|
Pablo Greco |
40546a |
virCgroupFree;
|
|
Pablo Greco |
40546a |
virCgroupGetBlkioDeviceReadBps;
|
|
Pablo Greco |
40546a |
virCgroupGetBlkioDeviceReadIops;
|
|
Pablo Greco |
40546a |
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
|
|
Pablo Greco |
40546a |
index 53f5faafd2..d55f411daa 100644
|
|
Pablo Greco |
40546a |
--- a/src/util/vircgroup.c
|
|
Pablo Greco |
40546a |
+++ b/src/util/vircgroup.c
|
|
Pablo Greco |
40546a |
@@ -429,7 +429,7 @@ virCgroupMountOptsMatchController(const char *mntOpts,
|
|
Pablo Greco |
40546a |
* Process /proc/mounts figuring out what controllers are
|
|
Pablo Greco |
40546a |
* mounted and where
|
|
Pablo Greco |
40546a |
*/
|
|
Pablo Greco |
40546a |
-int
|
|
Pablo Greco |
40546a |
+static int
|
|
Pablo Greco |
40546a |
virCgroupDetectMounts(virCgroupPtr group)
|
|
Pablo Greco |
40546a |
{
|
|
Pablo Greco |
40546a |
size_t i;
|
|
Pablo Greco |
40546a |
@@ -4080,15 +4080,6 @@ virCgroupAvailable(void)
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
-int
|
|
Pablo Greco |
40546a |
-virCgroupDetectMounts(virCgroupPtr group ATTRIBUTE_UNUSED)
|
|
Pablo Greco |
40546a |
-{
|
|
Pablo Greco |
40546a |
- virReportSystemError(ENXIO, "%s",
|
|
Pablo Greco |
40546a |
- _("Control groups not supported on this platform"));
|
|
Pablo Greco |
40546a |
- return -1;
|
|
Pablo Greco |
40546a |
-}
|
|
Pablo Greco |
40546a |
-
|
|
Pablo Greco |
40546a |
-
|
|
Pablo Greco |
40546a |
int
|
|
Pablo Greco |
40546a |
virCgroupNewPartition(const char *path ATTRIBUTE_UNUSED,
|
|
Pablo Greco |
40546a |
bool create ATTRIBUTE_UNUSED,
|
|
Pablo Greco |
40546a |
diff --git a/src/util/vircgrouppriv.h b/src/util/vircgrouppriv.h
|
|
Pablo Greco |
40546a |
index f78fe8bb9c..046c96c52c 100644
|
|
Pablo Greco |
40546a |
--- a/src/util/vircgrouppriv.h
|
|
Pablo Greco |
40546a |
+++ b/src/util/vircgrouppriv.h
|
|
Pablo Greco |
40546a |
@@ -50,8 +50,6 @@ struct _virCgroup {
|
|
Pablo Greco |
40546a |
virCgroupController controllers[VIR_CGROUP_CONTROLLER_LAST];
|
|
Pablo Greco |
40546a |
};
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
-int virCgroupDetectMounts(virCgroupPtr group);
|
|
Pablo Greco |
40546a |
-
|
|
Pablo Greco |
40546a |
int virCgroupNewPartition(const char *path,
|
|
Pablo Greco |
40546a |
bool create,
|
|
Pablo Greco |
40546a |
int controllers,
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/cgroups1.cgroups b/tests/vircgroupdata/cgroups1.cgroups
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..a03c290a98
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgroupdata/cgroups1.cgroups
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,11 @@
|
|
Pablo Greco |
40546a |
+#subsys_name hierarchy num_cgroups enabled
|
|
Pablo Greco |
40546a |
+cpuset 1 1 1
|
|
Pablo Greco |
40546a |
+cpu 2 1 1
|
|
Pablo Greco |
40546a |
+cpuacct 3 1 1
|
|
Pablo Greco |
40546a |
+blkio 8 1 1
|
|
Pablo Greco |
40546a |
+memory 4 1 1
|
|
Pablo Greco |
40546a |
+devices 5 1 1
|
|
Pablo Greco |
40546a |
+freezer 6 1 1
|
|
Pablo Greco |
40546a |
+net_cls 7 1 1
|
|
Pablo Greco |
40546a |
+net_prio 9 1 1
|
|
Pablo Greco |
40546a |
+hugetlb 10 1 1
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/cgroups1.self.cgroup b/tests/vircgroupdata/cgroups1.self.cgroup
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..181f0c22f8
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgroupdata/cgroups1.self.cgroup
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,11 @@
|
|
Pablo Greco |
40546a |
+10:hugetlb:/
|
|
Pablo Greco |
40546a |
+9:net_prio:/
|
|
Pablo Greco |
40546a |
+8:blkio:/
|
|
Pablo Greco |
40546a |
+7:net_cls:/
|
|
Pablo Greco |
40546a |
+6:freezer:/
|
|
Pablo Greco |
40546a |
+5:devices:/
|
|
Pablo Greco |
40546a |
+4:memory:/
|
|
Pablo Greco |
40546a |
+3:cpuacct:/
|
|
Pablo Greco |
40546a |
+2:cpu:/
|
|
Pablo Greco |
40546a |
+1:cpuset:/
|
|
Pablo Greco |
40546a |
+0:name=openrc:/
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/cgroups2.cgroups b/tests/vircgroupdata/cgroups2.cgroups
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..f0a7699559
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgroupdata/cgroups2.cgroups
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,10 @@
|
|
Pablo Greco |
40546a |
+#subsys_name hierarchy num_cgroups enabled
|
|
Pablo Greco |
40546a |
+cpuset 1 1 1
|
|
Pablo Greco |
40546a |
+cpu 2 1 1
|
|
Pablo Greco |
40546a |
+cpuacct 3 1 1
|
|
Pablo Greco |
40546a |
+blkio 7 1 1
|
|
Pablo Greco |
40546a |
+memory 4 1 1
|
|
Pablo Greco |
40546a |
+devices 5 1 1
|
|
Pablo Greco |
40546a |
+freezer 6 1 1
|
|
Pablo Greco |
40546a |
+perf_event 8 1 1
|
|
Pablo Greco |
40546a |
+hugetlb 9 1 1
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/cgroups2.self.cgroup b/tests/vircgroupdata/cgroups2.self.cgroup
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..3d0e793e5a
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgroupdata/cgroups2.self.cgroup
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,10 @@
|
|
Pablo Greco |
40546a |
+9:hugetlb:/
|
|
Pablo Greco |
40546a |
+8:perf_event:/
|
|
Pablo Greco |
40546a |
+7:blkio:/
|
|
Pablo Greco |
40546a |
+6:freezer:/
|
|
Pablo Greco |
40546a |
+5:devices:/
|
|
Pablo Greco |
40546a |
+4:memory:/
|
|
Pablo Greco |
40546a |
+3:cpuacct:/
|
|
Pablo Greco |
40546a |
+2:cpu:/
|
|
Pablo Greco |
40546a |
+1:cpuset:/
|
|
Pablo Greco |
40546a |
+0:name=openrc:/
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/cgroups3.cgroups b/tests/vircgroupdata/cgroups3.cgroups
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..294d95dedf
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgroupdata/cgroups3.cgroups
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,12 @@
|
|
Pablo Greco |
40546a |
+#subsys_name hierarchy num_cgroups enabled
|
|
Pablo Greco |
40546a |
+cpuset 1 1 1
|
|
Pablo Greco |
40546a |
+cpu 2 1 1
|
|
Pablo Greco |
40546a |
+cpuacct 3 1 1
|
|
Pablo Greco |
40546a |
+blkio 8 1 1
|
|
Pablo Greco |
40546a |
+memory 4 1 1
|
|
Pablo Greco |
40546a |
+devices 5 1 1
|
|
Pablo Greco |
40546a |
+freezer 6 1 1
|
|
Pablo Greco |
40546a |
+net_cls 7 1 1
|
|
Pablo Greco |
40546a |
+perf_event 9 1 1
|
|
Pablo Greco |
40546a |
+net_prio 10 1 1
|
|
Pablo Greco |
40546a |
+hugetlb 11 1 1
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/cgroups3.self.cgroup b/tests/vircgroupdata/cgroups3.self.cgroup
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..bf346abdf9
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgroupdata/cgroups3.self.cgroup
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,12 @@
|
|
Pablo Greco |
40546a |
+11:hugetlb:/
|
|
Pablo Greco |
40546a |
+10:net_prio:/
|
|
Pablo Greco |
40546a |
+9:perf_event:/
|
|
Pablo Greco |
40546a |
+8:blkio:/
|
|
Pablo Greco |
40546a |
+7:net_cls:/
|
|
Pablo Greco |
40546a |
+6:freezer:/
|
|
Pablo Greco |
40546a |
+5:devices:/
|
|
Pablo Greco |
40546a |
+4:memory:/
|
|
Pablo Greco |
40546a |
+3:cpuacct:/
|
|
Pablo Greco |
40546a |
+2:cpu:/
|
|
Pablo Greco |
40546a |
+1:cpuset:/
|
|
Pablo Greco |
40546a |
+0:name=openrc:/
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/fedora-18.cgroups b/tests/vircgroupdata/fedora-18.cgroups
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..8eb41087f3
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgroupdata/fedora-18.cgroups
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,10 @@
|
|
Pablo Greco |
40546a |
+#subsys_name hierarchy num_cgroups enabled
|
|
Pablo Greco |
40546a |
+cpuset 1 1 1
|
|
Pablo Greco |
40546a |
+cpu 2 1 1
|
|
Pablo Greco |
40546a |
+cpuacct 2 1 1
|
|
Pablo Greco |
40546a |
+blkio 7 1 1
|
|
Pablo Greco |
40546a |
+memory 3 1 1
|
|
Pablo Greco |
40546a |
+devices 4 1 1
|
|
Pablo Greco |
40546a |
+freezer 5 1 1
|
|
Pablo Greco |
40546a |
+net_cls 6 1 1
|
|
Pablo Greco |
40546a |
+perf_event 8 1 1
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/fedora-18.self.cgroup b/tests/vircgroupdata/fedora-18.self.cgroup
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..da9ad8ad4d
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgroupdata/fedora-18.self.cgroup
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,9 @@
|
|
Pablo Greco |
40546a |
+8:perf_event:/
|
|
Pablo Greco |
40546a |
+7:blkio:/
|
|
Pablo Greco |
40546a |
+6:net_cls:/
|
|
Pablo Greco |
40546a |
+5:freezer:/
|
|
Pablo Greco |
40546a |
+4:devices:/
|
|
Pablo Greco |
40546a |
+3:memory:/
|
|
Pablo Greco |
40546a |
+2:cpu,cpuacct:/
|
|
Pablo Greco |
40546a |
+1:cpuset:/
|
|
Pablo Greco |
40546a |
+0:name=systemd:/
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/fedora-21.cgroups b/tests/vircgroupdata/fedora-21.cgroups
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..3e1401ee98
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgroupdata/fedora-21.cgroups
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,12 @@
|
|
Pablo Greco |
40546a |
+#subsys_name hierarchy num_cgroups enabled
|
|
Pablo Greco |
40546a |
+cpuset 1 1 1
|
|
Pablo Greco |
40546a |
+cpu 2 1 1
|
|
Pablo Greco |
40546a |
+cpuacct 2 1 1
|
|
Pablo Greco |
40546a |
+blkio 7 1 1
|
|
Pablo Greco |
40546a |
+memory 3 1 1
|
|
Pablo Greco |
40546a |
+devices 4 1 1
|
|
Pablo Greco |
40546a |
+freezer 5 1 1
|
|
Pablo Greco |
40546a |
+net_cls 6 1 1
|
|
Pablo Greco |
40546a |
+perf_event 8 1 1
|
|
Pablo Greco |
40546a |
+net_prio 6 1 1
|
|
Pablo Greco |
40546a |
+hugetlb 9 1 1
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/fedora-21.self.cgroup b/tests/vircgroupdata/fedora-21.self.cgroup
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..4c666bd59e
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgroupdata/fedora-21.self.cgroup
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,10 @@
|
|
Pablo Greco |
40546a |
+9:hugetlb:/
|
|
Pablo Greco |
40546a |
+8:perf_event:/
|
|
Pablo Greco |
40546a |
+7:blkio:/
|
|
Pablo Greco |
40546a |
+6:net_cls,net_prio:/
|
|
Pablo Greco |
40546a |
+5:freezer:/
|
|
Pablo Greco |
40546a |
+4:devices:/
|
|
Pablo Greco |
40546a |
+3:memory:/
|
|
Pablo Greco |
40546a |
+2:cpu,cpuacct:/
|
|
Pablo Greco |
40546a |
+1:cpuset:/
|
|
Pablo Greco |
40546a |
+0:name=systemd:/
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/kubevirt.cgroups b/tests/vircgroupdata/kubevirt.cgroups
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..f0a7699559
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgroupdata/kubevirt.cgroups
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,10 @@
|
|
Pablo Greco |
40546a |
+#subsys_name hierarchy num_cgroups enabled
|
|
Pablo Greco |
40546a |
+cpuset 1 1 1
|
|
Pablo Greco |
40546a |
+cpu 2 1 1
|
|
Pablo Greco |
40546a |
+cpuacct 3 1 1
|
|
Pablo Greco |
40546a |
+blkio 7 1 1
|
|
Pablo Greco |
40546a |
+memory 4 1 1
|
|
Pablo Greco |
40546a |
+devices 5 1 1
|
|
Pablo Greco |
40546a |
+freezer 6 1 1
|
|
Pablo Greco |
40546a |
+perf_event 8 1 1
|
|
Pablo Greco |
40546a |
+hugetlb 9 1 1
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/kubevirt.self.cgroup b/tests/vircgroupdata/kubevirt.self.cgroup
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..3d0e793e5a
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgroupdata/kubevirt.self.cgroup
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,10 @@
|
|
Pablo Greco |
40546a |
+9:hugetlb:/
|
|
Pablo Greco |
40546a |
+8:perf_event:/
|
|
Pablo Greco |
40546a |
+7:blkio:/
|
|
Pablo Greco |
40546a |
+6:freezer:/
|
|
Pablo Greco |
40546a |
+5:devices:/
|
|
Pablo Greco |
40546a |
+4:memory:/
|
|
Pablo Greco |
40546a |
+3:cpuacct:/
|
|
Pablo Greco |
40546a |
+2:cpu:/
|
|
Pablo Greco |
40546a |
+1:cpuset:/
|
|
Pablo Greco |
40546a |
+0:name=openrc:/
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/no-cgroups.cgroups b/tests/vircgroupdata/no-cgroups.cgroups
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..3ed1d4e45e
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgroupdata/no-cgroups.cgroups
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,8 @@
|
|
Pablo Greco |
40546a |
+#subsys_name hierarchy num_cgroups enabled
|
|
Pablo Greco |
40546a |
+cpuset 0 1 1
|
|
Pablo Greco |
40546a |
+cpu 0 1 1
|
|
Pablo Greco |
40546a |
+cpuacct 0 1 1
|
|
Pablo Greco |
40546a |
+memory 0 1 1
|
|
Pablo Greco |
40546a |
+devices 0 1 1
|
|
Pablo Greco |
40546a |
+freezer 0 1 1
|
|
Pablo Greco |
40546a |
+blkio 0 1 1
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/no-cgroups.parsed b/tests/vircgroupdata/no-cgroups.parsed
|
|
Pablo Greco |
40546a |
deleted file mode 100644
|
|
Pablo Greco |
40546a |
index bf4eea085f..0000000000
|
|
Pablo Greco |
40546a |
--- a/tests/vircgroupdata/no-cgroups.parsed
|
|
Pablo Greco |
40546a |
+++ /dev/null
|
|
Pablo Greco |
40546a |
@@ -1,10 +0,0 @@
|
|
Pablo Greco |
40546a |
-cpu <null>
|
|
Pablo Greco |
40546a |
-cpuacct <null>
|
|
Pablo Greco |
40546a |
-cpuset <null>
|
|
Pablo Greco |
40546a |
-memory <null>
|
|
Pablo Greco |
40546a |
-devices <null>
|
|
Pablo Greco |
40546a |
-freezer <null>
|
|
Pablo Greco |
40546a |
-blkio <null>
|
|
Pablo Greco |
40546a |
-net_cls <null>
|
|
Pablo Greco |
40546a |
-perf_event <null>
|
|
Pablo Greco |
40546a |
-name=systemd <null>
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/no-cgroups.self.cgroup b/tests/vircgroupdata/no-cgroups.self.cgroup
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..e69de29bb2
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/ovirt-node-6.6.cgroups b/tests/vircgroupdata/ovirt-node-6.6.cgroups
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..aaabf11a44
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgroupdata/ovirt-node-6.6.cgroups
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,9 @@
|
|
Pablo Greco |
40546a |
+#subsys_name hierarchy num_cgroups enabled
|
|
Pablo Greco |
40546a |
+cpuset 0 1 1
|
|
Pablo Greco |
40546a |
+cpu 1 1 1
|
|
Pablo Greco |
40546a |
+cpuacct 2 1 1
|
|
Pablo Greco |
40546a |
+blkio 7 1 1
|
|
Pablo Greco |
40546a |
+memory 3 1 1
|
|
Pablo Greco |
40546a |
+devices 4 1 1
|
|
Pablo Greco |
40546a |
+freezer 5 1 1
|
|
Pablo Greco |
40546a |
+net_cls 6 1 1
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/ovirt-node-6.6.self.cgroup b/tests/vircgroupdata/ovirt-node-6.6.self.cgroup
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..dadc8155fa
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgroupdata/ovirt-node-6.6.self.cgroup
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,8 @@
|
|
Pablo Greco |
40546a |
+7:blkio:/
|
|
Pablo Greco |
40546a |
+6:net_cls:/
|
|
Pablo Greco |
40546a |
+5:freezer:/
|
|
Pablo Greco |
40546a |
+4:devices:/
|
|
Pablo Greco |
40546a |
+3:memory:/
|
|
Pablo Greco |
40546a |
+2:cpuacct:/
|
|
Pablo Greco |
40546a |
+1:cpu:/
|
|
Pablo Greco |
40546a |
+0:cpuset:/
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/ovirt-node-7.1.cgroups b/tests/vircgroupdata/ovirt-node-7.1.cgroups
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..687297ad4a
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgroupdata/ovirt-node-7.1.cgroups
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,11 @@
|
|
Pablo Greco |
40546a |
+#subsys_name hierarchy num_cgroups enabled
|
|
Pablo Greco |
40546a |
+cpuset 1 1 1
|
|
Pablo Greco |
40546a |
+cpu 2 1 1
|
|
Pablo Greco |
40546a |
+cpuacct 2 1 1
|
|
Pablo Greco |
40546a |
+blkio 7 1 1
|
|
Pablo Greco |
40546a |
+memory 3 1 1
|
|
Pablo Greco |
40546a |
+devices 4 1 1
|
|
Pablo Greco |
40546a |
+freezer 5 1 1
|
|
Pablo Greco |
40546a |
+net_cls 6 1 1
|
|
Pablo Greco |
40546a |
+perf_event 8 1 1
|
|
Pablo Greco |
40546a |
+hugetlb 9 1 1
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/ovirt-node-7.1.self.cgroup b/tests/vircgroupdata/ovirt-node-7.1.self.cgroup
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..f07e8e20f5
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgroupdata/ovirt-node-7.1.self.cgroup
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,10 @@
|
|
Pablo Greco |
40546a |
+9:hugetlb:/
|
|
Pablo Greco |
40546a |
+8:perf_event:/
|
|
Pablo Greco |
40546a |
+7:blkio:/
|
|
Pablo Greco |
40546a |
+6:net_cls:/
|
|
Pablo Greco |
40546a |
+5:freezer:/
|
|
Pablo Greco |
40546a |
+4:devices:/
|
|
Pablo Greco |
40546a |
+3:memory:/
|
|
Pablo Greco |
40546a |
+2:cpu,cpuacct:/
|
|
Pablo Greco |
40546a |
+1:cpuset:/
|
|
Pablo Greco |
40546a |
+0:name=systemd:/
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/rhel-7.1.cgroups b/tests/vircgroupdata/rhel-7.1.cgroups
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..687297ad4a
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgroupdata/rhel-7.1.cgroups
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,11 @@
|
|
Pablo Greco |
40546a |
+#subsys_name hierarchy num_cgroups enabled
|
|
Pablo Greco |
40546a |
+cpuset 1 1 1
|
|
Pablo Greco |
40546a |
+cpu 2 1 1
|
|
Pablo Greco |
40546a |
+cpuacct 2 1 1
|
|
Pablo Greco |
40546a |
+blkio 7 1 1
|
|
Pablo Greco |
40546a |
+memory 3 1 1
|
|
Pablo Greco |
40546a |
+devices 4 1 1
|
|
Pablo Greco |
40546a |
+freezer 5 1 1
|
|
Pablo Greco |
40546a |
+net_cls 6 1 1
|
|
Pablo Greco |
40546a |
+perf_event 8 1 1
|
|
Pablo Greco |
40546a |
+hugetlb 9 1 1
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgroupdata/rhel-7.1.self.cgroup b/tests/vircgroupdata/rhel-7.1.self.cgroup
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..f07e8e20f5
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgroupdata/rhel-7.1.self.cgroup
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,10 @@
|
|
Pablo Greco |
40546a |
+9:hugetlb:/
|
|
Pablo Greco |
40546a |
+8:perf_event:/
|
|
Pablo Greco |
40546a |
+7:blkio:/
|
|
Pablo Greco |
40546a |
+6:net_cls:/
|
|
Pablo Greco |
40546a |
+5:freezer:/
|
|
Pablo Greco |
40546a |
+4:devices:/
|
|
Pablo Greco |
40546a |
+3:memory:/
|
|
Pablo Greco |
40546a |
+2:cpu,cpuacct:/
|
|
Pablo Greco |
40546a |
+1:cpuset:/
|
|
Pablo Greco |
40546a |
+0:name=systemd:/
|
|
Pablo Greco |
40546a |
diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c
|
|
Pablo Greco |
40546a |
index 6a38091a86..5031a2973d 100644
|
|
Pablo Greco |
40546a |
--- a/tests/vircgrouptest.c
|
|
Pablo Greco |
40546a |
+++ b/tests/vircgrouptest.c
|
|
Pablo Greco |
40546a |
@@ -159,26 +159,37 @@ const char *linksLogind[VIR_CGROUP_CONTROLLER_LAST] = {
|
|
Pablo Greco |
40546a |
};
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
+struct _detectMountsData {
|
|
Pablo Greco |
40546a |
+ const char *file;
|
|
Pablo Greco |
40546a |
+ bool fail;
|
|
Pablo Greco |
40546a |
+};
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
static int
|
|
Pablo Greco |
40546a |
testCgroupDetectMounts(const void *args)
|
|
Pablo Greco |
40546a |
{
|
|
Pablo Greco |
40546a |
int result = -1;
|
|
Pablo Greco |
40546a |
- const char *file = args;
|
|
Pablo Greco |
40546a |
+ const struct _detectMountsData *data = args;
|
|
Pablo Greco |
40546a |
char *parsed = NULL;
|
|
Pablo Greco |
40546a |
const char *actual;
|
|
Pablo Greco |
40546a |
virCgroupPtr group = NULL;
|
|
Pablo Greco |
40546a |
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
|
Pablo Greco |
40546a |
size_t i;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
- setenv("VIR_CGROUP_MOCK_FILENAME", file, 1);
|
|
Pablo Greco |
40546a |
+ setenv("VIR_CGROUP_MOCK_FILENAME", data->file, 1);
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
- if (virAsprintf(&parsed, "%s/vircgroupdata/%s.parsed", abs_srcdir, file) < 0)
|
|
Pablo Greco |
40546a |
+ if (virAsprintf(&parsed, "%s/vircgroupdata/%s.parsed",
|
|
Pablo Greco |
40546a |
+ abs_srcdir, data->file) < 0) {
|
|
Pablo Greco |
40546a |
goto cleanup;
|
|
Pablo Greco |
40546a |
+ }
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
- if (VIR_ALLOC(group) < 0)
|
|
Pablo Greco |
40546a |
+ if (virCgroupNewSelf(&group) < 0) {
|
|
Pablo Greco |
40546a |
+ if (data->fail)
|
|
Pablo Greco |
40546a |
+ result = 0;
|
|
Pablo Greco |
40546a |
goto cleanup;
|
|
Pablo Greco |
40546a |
+ }
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
- if (virCgroupDetectMounts(group) < 0)
|
|
Pablo Greco |
40546a |
+ if (data->fail)
|
|
Pablo Greco |
40546a |
goto cleanup;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
|
|
Pablo Greco |
40546a |
@@ -870,13 +881,16 @@ mymain(void)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1);
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
-# define DETECT_MOUNTS(file) \
|
|
Pablo Greco |
40546a |
+# define DETECT_MOUNTS_FULL(file, fail) \
|
|
Pablo Greco |
40546a |
do { \
|
|
Pablo Greco |
40546a |
+ struct _detectMountsData data = { file, fail }; \
|
|
Pablo Greco |
40546a |
if (virTestRun("Detect cgroup mounts for " file, \
|
|
Pablo Greco |
40546a |
testCgroupDetectMounts, \
|
|
Pablo Greco |
40546a |
- file) < 0) \
|
|
Pablo Greco |
40546a |
+ &data) < 0) \
|
|
Pablo Greco |
40546a |
ret = -1; \
|
|
Pablo Greco |
40546a |
} while (0)
|
|
Pablo Greco |
40546a |
+# define DETECT_MOUNTS(file) DETECT_MOUNTS_FULL(file, false);
|
|
Pablo Greco |
40546a |
+# define DETECT_MOUNTS_FAIL(file) DETECT_MOUNTS_FULL(file, true);
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
DETECT_MOUNTS("ovirt-node-6.6");
|
|
Pablo Greco |
40546a |
DETECT_MOUNTS("ovirt-node-7.1");
|
|
Pablo Greco |
40546a |
@@ -887,7 +901,7 @@ mymain(void)
|
|
Pablo Greco |
40546a |
DETECT_MOUNTS("cgroups2");
|
|
Pablo Greco |
40546a |
DETECT_MOUNTS("cgroups3");
|
|
Pablo Greco |
40546a |
DETECT_MOUNTS("all-in-one");
|
|
Pablo Greco |
40546a |
- DETECT_MOUNTS("no-cgroups");
|
|
Pablo Greco |
40546a |
+ DETECT_MOUNTS_FAIL("no-cgroups");
|
|
Pablo Greco |
40546a |
DETECT_MOUNTS("kubevirt");
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
setenv("VIR_CGROUP_MOCK_FILENAME", "systemd", 1);
|
|
Pablo Greco |
40546a |
--
|
|
Pablo Greco |
40546a |
2.22.0
|
|
Pablo Greco |
40546a |
|