render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
Blob Blame History Raw
From ab8447f6e6a5ab8e3d278be61bc9ccc93c435d3b Mon Sep 17 00:00:00 2001
Message-Id: <ab8447f6e6a5ab8e3d278be61bc9ccc93c435d3b@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Mon, 1 Jul 2019 17:07:58 +0200
Subject: [PATCH] vircgrouptest: add detect mounts test for cgroup v2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 8f43c7a698b7a360d508eccc82ffc08e930cc3f8)

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Message-Id: <10b25253a0f4705093b96cfe56a0c64bb2114785.1561993100.git.phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 tests/vircgroupdata/unified.cgroups     | 13 +++++++++++++
 tests/vircgroupdata/unified.mounts      | 20 ++++++++++++++++++++
 tests/vircgroupdata/unified.parsed      | 11 +++++++++++
 tests/vircgroupdata/unified.self.cgroup |  1 +
 tests/vircgrouptest.c                   |  3 +++
 5 files changed, 48 insertions(+)
 create mode 100644 tests/vircgroupdata/unified.cgroups
 create mode 100644 tests/vircgroupdata/unified.mounts
 create mode 100644 tests/vircgroupdata/unified.parsed
 create mode 100644 tests/vircgroupdata/unified.self.cgroup

diff --git a/tests/vircgroupdata/unified.cgroups b/tests/vircgroupdata/unified.cgroups
new file mode 100644
index 0000000000..e0d8a3561c
--- /dev/null
+++ b/tests/vircgroupdata/unified.cgroups
@@ -0,0 +1,13 @@
+#subsys_name	hierarchy	num_cgroups	enabled
+cpuset      0       1       1
+cpu         0       1       1
+cpuacct     0       1       1
+blkio       0       1       1
+memory      0       1       1
+devices     0       1       1
+freezer     0       1       1
+net_cls     0       1       1
+perf_event  0       1       1
+net_prio    0       1       1
+hugetlb     0       1       1
+pids        0       1       1
diff --git a/tests/vircgroupdata/unified.mounts b/tests/vircgroupdata/unified.mounts
new file mode 100644
index 0000000000..b4ab94a2c3
--- /dev/null
+++ b/tests/vircgroupdata/unified.mounts
@@ -0,0 +1,20 @@
+sysfs /sys sysfs rw,seclabel,nosuid,nodev,noexec,relatime 0 0
+proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
+devtmpfs /dev devtmpfs rw,seclabel,nosuid,size=1009844k,nr_inodes=252461,mode=755 0 0
+securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0
+tmpfs /dev/shm tmpfs rw,seclabel,nosuid,nodev 0 0
+devpts /dev/pts devpts rw,seclabel,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
+tmpfs /run tmpfs rw,seclabel,nosuid,nodev,mode=755 0 0
+cgroup2 /not/really/sys/fs/cgroup cgroup2 rw,seclabel,nosuid,nodev,noexec,relatime,nsdelegate 0 0
+pstore /sys/fs/pstore pstore rw,seclabel,nosuid,nodev,noexec,relatime 0 0
+bpf /sys/fs/bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700 0 0
+configfs /sys/kernel/config configfs rw,relatime 0 0
+/dev/vda2 / ext4 rw,seclabel,relatime 0 0
+selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0
+debugfs /sys/kernel/debug debugfs rw,seclabel,relatime 0 0
+hugetlbfs /dev/hugepages hugetlbfs rw,seclabel,relatime,pagesize=2M 0 0
+systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=40,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=14586 0 0
+mqueue /dev/mqueue mqueue rw,seclabel,relatime 0 0
+tmpfs /tmp tmpfs rw,seclabel,nosuid,nodev 0 0
+sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw,relatime 0 0
+tmpfs /run/user/0 tmpfs rw,seclabel,nosuid,nodev,relatime,size=204000k,mode=700 0 0
diff --git a/tests/vircgroupdata/unified.parsed b/tests/vircgroupdata/unified.parsed
new file mode 100644
index 0000000000..3de0fc643d
--- /dev/null
+++ b/tests/vircgroupdata/unified.parsed
@@ -0,0 +1,11 @@
+cpu          <null>
+cpuacct      <null>
+cpuset       <null>
+memory       <null>
+devices      <null>
+freezer      <null>
+blkio        <null>
+net_cls      <null>
+perf_event   <null>
+name=systemd <null>
+unified      /not/really/sys/fs/cgroup
diff --git a/tests/vircgroupdata/unified.self.cgroup b/tests/vircgroupdata/unified.self.cgroup
new file mode 100644
index 0000000000..1e027b2a3c
--- /dev/null
+++ b/tests/vircgroupdata/unified.self.cgroup
@@ -0,0 +1 @@
+0::/
diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c
index b66682e6c8..1ce1371ddc 100644
--- a/tests/vircgrouptest.c
+++ b/tests/vircgrouptest.c
@@ -900,6 +900,9 @@ mymain(void)
     DETECT_MOUNTS("all-in-one");
     DETECT_MOUNTS_FAIL("no-cgroups");
     DETECT_MOUNTS("kubevirt");
+    fakerootdir = initFakeFS("unified", NULL);
+    DETECT_MOUNTS("unified");
+    cleanupFakeFS(fakerootdir);
 
     fakerootdir = initFakeFS(NULL, "systemd");
     if (virTestRun("New cgroup for self", testCgroupNewForSelf, NULL) < 0)
-- 
2.22.0