On Thu, Sep 20, 2018 at 10:54:38AM +0200, Pavel Hrdina wrote:
This will be required once cgroup v2 is introduced. The cgroup
detection is not simple and we will have multiple backends so we
should not just jump into the middle of the detection code.
In order to use virCgroupNewSelf we need to create all the remaining
data files:
- {name}.cgroups represents /proc/cgroups, it is a list of cgroup
controllers compiled into kernel
- {name}.self.cgroup represents /proc/self/cgroup, it describes
cgroups to which the process belongs
For "no-cgroups" we need to modify the expected behavior because
virCgroupNewSelf() will fail if there are no controllers available.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
Notes:
changes in v2:
- no-cgroups detect test is now expected to fail
src/libvirt_private.syms | 1 -
src/util/vircgroup.c | 11 +------
src/util/vircgrouppriv.h | 2 --
tests/vircgroupdata/cgroups1.cgroups | 11 +++++++
tests/vircgroupdata/cgroups1.self.cgroup | 11 +++++++
tests/vircgroupdata/cgroups2.cgroups | 10 +++++++
tests/vircgroupdata/cgroups2.self.cgroup | 10 +++++++
tests/vircgroupdata/cgroups3.cgroups | 12 ++++++++
tests/vircgroupdata/cgroups3.self.cgroup | 12 ++++++++
tests/vircgroupdata/fedora-18.cgroups | 10 +++++++
tests/vircgroupdata/fedora-18.self.cgroup | 9 ++++++
tests/vircgroupdata/fedora-21.cgroups | 12 ++++++++
tests/vircgroupdata/fedora-21.self.cgroup | 10 +++++++
tests/vircgroupdata/kubevirt.cgroups | 10 +++++++
tests/vircgroupdata/kubevirt.self.cgroup | 10 +++++++
tests/vircgroupdata/no-cgroups.cgroups | 8 +++++
tests/vircgroupdata/no-cgroups.parsed | 10 -------
tests/vircgroupdata/no-cgroups.self.cgroup | 0
tests/vircgroupdata/ovirt-node-6.6.cgroups | 9 ++++++
.../vircgroupdata/ovirt-node-6.6.self.cgroup | 8 +++++
tests/vircgroupdata/ovirt-node-7.1.cgroups | 11 +++++++
.../vircgroupdata/ovirt-node-7.1.self.cgroup | 10 +++++++
tests/vircgroupdata/rhel-7.1.cgroups | 11 +++++++
tests/vircgroupdata/rhel-7.1.self.cgroup | 10 +++++++
tests/vircgrouptest.c | 30 ++++++++++++++-----
25 files changed, 217 insertions(+), 31 deletions(-)
create mode 100644 tests/vircgroupdata/cgroups1.cgroups
create mode 100644 tests/vircgroupdata/cgroups1.self.cgroup
create mode 100644 tests/vircgroupdata/cgroups2.cgroups
create mode 100644 tests/vircgroupdata/cgroups2.self.cgroup
create mode 100644 tests/vircgroupdata/cgroups3.cgroups
create mode 100644 tests/vircgroupdata/cgroups3.self.cgroup
create mode 100644 tests/vircgroupdata/fedora-18.cgroups
create mode 100644 tests/vircgroupdata/fedora-18.self.cgroup
create mode 100644 tests/vircgroupdata/fedora-21.cgroups
create mode 100644 tests/vircgroupdata/fedora-21.self.cgroup
create mode 100644 tests/vircgroupdata/kubevirt.cgroups
create mode 100644 tests/vircgroupdata/kubevirt.self.cgroup
create mode 100644 tests/vircgroupdata/no-cgroups.cgroups
delete mode 100644 tests/vircgroupdata/no-cgroups.parsed
create mode 100644 tests/vircgroupdata/no-cgroups.self.cgroup
create mode 100644 tests/vircgroupdata/ovirt-node-6.6.cgroups
create mode 100644 tests/vircgroupdata/ovirt-node-6.6.self.cgroup
create mode 100644 tests/vircgroupdata/ovirt-node-7.1.cgroups
create mode 100644 tests/vircgroupdata/ovirt-node-7.1.self.cgroup
create mode 100644 tests/vircgroupdata/rhel-7.1.cgroups
create mode 100644 tests/vircgroupdata/rhel-7.1.self.cgroup
Having the 'struct _detectMountsData' addition separate would make the
diff more relevant.
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano