render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
c313de
From ab8447f6e6a5ab8e3d278be61bc9ccc93c435d3b Mon Sep 17 00:00:00 2001
c313de
Message-Id: <ab8447f6e6a5ab8e3d278be61bc9ccc93c435d3b@dist-git>
c313de
From: Pavel Hrdina <phrdina@redhat.com>
c313de
Date: Mon, 1 Jul 2019 17:07:58 +0200
c313de
Subject: [PATCH] vircgrouptest: add detect mounts test for cgroup v2
c313de
MIME-Version: 1.0
c313de
Content-Type: text/plain; charset=UTF-8
c313de
Content-Transfer-Encoding: 8bit
c313de
c313de
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
c313de
(cherry picked from commit 8f43c7a698b7a360d508eccc82ffc08e930cc3f8)
c313de
c313de
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
c313de
c313de
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
c313de
Message-Id: <10b25253a0f4705093b96cfe56a0c64bb2114785.1561993100.git.phrdina@redhat.com>
c313de
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c313de
---
c313de
 tests/vircgroupdata/unified.cgroups     | 13 +++++++++++++
c313de
 tests/vircgroupdata/unified.mounts      | 20 ++++++++++++++++++++
c313de
 tests/vircgroupdata/unified.parsed      | 11 +++++++++++
c313de
 tests/vircgroupdata/unified.self.cgroup |  1 +
c313de
 tests/vircgrouptest.c                   |  3 +++
c313de
 5 files changed, 48 insertions(+)
c313de
 create mode 100644 tests/vircgroupdata/unified.cgroups
c313de
 create mode 100644 tests/vircgroupdata/unified.mounts
c313de
 create mode 100644 tests/vircgroupdata/unified.parsed
c313de
 create mode 100644 tests/vircgroupdata/unified.self.cgroup
c313de
c313de
diff --git a/tests/vircgroupdata/unified.cgroups b/tests/vircgroupdata/unified.cgroups
c313de
new file mode 100644
c313de
index 0000000000..e0d8a3561c
c313de
--- /dev/null
c313de
+++ b/tests/vircgroupdata/unified.cgroups
c313de
@@ -0,0 +1,13 @@
c313de
+#subsys_name	hierarchy	num_cgroups	enabled
c313de
+cpuset      0       1       1
c313de
+cpu         0       1       1
c313de
+cpuacct     0       1       1
c313de
+blkio       0       1       1
c313de
+memory      0       1       1
c313de
+devices     0       1       1
c313de
+freezer     0       1       1
c313de
+net_cls     0       1       1
c313de
+perf_event  0       1       1
c313de
+net_prio    0       1       1
c313de
+hugetlb     0       1       1
c313de
+pids        0       1       1
c313de
diff --git a/tests/vircgroupdata/unified.mounts b/tests/vircgroupdata/unified.mounts
c313de
new file mode 100644
c313de
index 0000000000..b4ab94a2c3
c313de
--- /dev/null
c313de
+++ b/tests/vircgroupdata/unified.mounts
c313de
@@ -0,0 +1,20 @@
c313de
+sysfs /sys sysfs rw,seclabel,nosuid,nodev,noexec,relatime 0 0
c313de
+proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
c313de
+devtmpfs /dev devtmpfs rw,seclabel,nosuid,size=1009844k,nr_inodes=252461,mode=755 0 0
c313de
+securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0
c313de
+tmpfs /dev/shm tmpfs rw,seclabel,nosuid,nodev 0 0
c313de
+devpts /dev/pts devpts rw,seclabel,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
c313de
+tmpfs /run tmpfs rw,seclabel,nosuid,nodev,mode=755 0 0
c313de
+cgroup2 /not/really/sys/fs/cgroup cgroup2 rw,seclabel,nosuid,nodev,noexec,relatime,nsdelegate 0 0
c313de
+pstore /sys/fs/pstore pstore rw,seclabel,nosuid,nodev,noexec,relatime 0 0
c313de
+bpf /sys/fs/bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700 0 0
c313de
+configfs /sys/kernel/config configfs rw,relatime 0 0
c313de
+/dev/vda2 / ext4 rw,seclabel,relatime 0 0
c313de
+selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0
c313de
+debugfs /sys/kernel/debug debugfs rw,seclabel,relatime 0 0
c313de
+hugetlbfs /dev/hugepages hugetlbfs rw,seclabel,relatime,pagesize=2M 0 0
c313de
+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
c313de
+mqueue /dev/mqueue mqueue rw,seclabel,relatime 0 0
c313de
+tmpfs /tmp tmpfs rw,seclabel,nosuid,nodev 0 0
c313de
+sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw,relatime 0 0
c313de
+tmpfs /run/user/0 tmpfs rw,seclabel,nosuid,nodev,relatime,size=204000k,mode=700 0 0
c313de
diff --git a/tests/vircgroupdata/unified.parsed b/tests/vircgroupdata/unified.parsed
c313de
new file mode 100644
c313de
index 0000000000..3de0fc643d
c313de
--- /dev/null
c313de
+++ b/tests/vircgroupdata/unified.parsed
c313de
@@ -0,0 +1,11 @@
c313de
+cpu          <null>
c313de
+cpuacct      <null>
c313de
+cpuset       <null>
c313de
+memory       <null>
c313de
+devices      <null>
c313de
+freezer      <null>
c313de
+blkio        <null>
c313de
+net_cls      <null>
c313de
+perf_event   <null>
c313de
+name=systemd <null>
c313de
+unified      /not/really/sys/fs/cgroup
c313de
diff --git a/tests/vircgroupdata/unified.self.cgroup b/tests/vircgroupdata/unified.self.cgroup
c313de
new file mode 100644
c313de
index 0000000000..1e027b2a3c
c313de
--- /dev/null
c313de
+++ b/tests/vircgroupdata/unified.self.cgroup
c313de
@@ -0,0 +1 @@
c313de
+0::/
c313de
diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c
c313de
index b66682e6c8..1ce1371ddc 100644
c313de
--- a/tests/vircgrouptest.c
c313de
+++ b/tests/vircgrouptest.c
c313de
@@ -900,6 +900,9 @@ mymain(void)
c313de
     DETECT_MOUNTS("all-in-one");
c313de
     DETECT_MOUNTS_FAIL("no-cgroups");
c313de
     DETECT_MOUNTS("kubevirt");
c313de
+    fakerootdir = initFakeFS("unified", NULL);
c313de
+    DETECT_MOUNTS("unified");
c313de
+    cleanupFakeFS(fakerootdir);
c313de
 
c313de
     fakerootdir = initFakeFS(NULL, "systemd");
c313de
     if (virTestRun("New cgroup for self", testCgroupNewForSelf, NULL) < 0)
c313de
-- 
c313de
2.22.0
c313de