On 10/29/2021 7:31 AM, Michal Prívozník wrote:
On 10/22/21 5:37 PM, Praveen K Paladugu wrote:
From: Vineeth Pillai <viremana@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Vineeth Pillai <viremana@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Praveen K Paladugu <prapal@xxxxxxxxxxxxxxxxxxx>
---
po/POTFILES.in | 1 +
src/ch/ch_cgroup.c | 457 ++++++++++++++++++++++++++++++++++++++++++++
src/ch/ch_cgroup.h | 45 +++++
src/ch/ch_conf.c | 2 +
src/ch/ch_conf.h | 4 +-
src/ch/ch_domain.c | 33 ++++
src/ch/ch_domain.h | 3 +-
src/ch/ch_monitor.c | 125 ++++++++++--
src/ch/ch_monitor.h | 54 +++++-
src/ch/ch_process.c | 288 +++++++++++++++++++++++++++-
src/ch/ch_process.h | 3 +
src/ch/meson.build | 2 +
12 files changed, 991 insertions(+), 26 deletions(-)
create mode 100644 src/ch/ch_cgroup.c
create mode 100644 src/ch/ch_cgroup.h
diff --git a/po/POTFILES.in b/po/POTFILES.in
index b554cf08ca..3a8db501bc 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -19,6 +19,7 @@
@SRCDIR@src/bhyve/bhyve_parse_command.c
@SRCDIR@src/bhyve/bhyve_process.c
@SRCDIR@src/ch/ch_conf.c
+@SRCDIR@src/ch/ch_cgroup.c
@SRCDIR@src/ch/ch_domain.c
@SRCDIR@src/ch/ch_driver.c
@SRCDIR@src/ch/ch_monitor.c
diff --git a/src/ch/ch_cgroup.c b/src/ch/ch_cgroup.c
new file mode 100644
index 0000000000..6be2184cf1
--- /dev/null
+++ b/src/ch/ch_cgroup.c
@@ -0,0 +1,457 @@
+/*
+ * ch_cgroup.c: CH cgroup management
This file is a verbatim copy of qemu_cgroup.c (except for some
formatting shenanigans). I wonder whether instead of copying code we can
move it under hypervisor agnostic location (src/hypervisor/) and then
only call respective functions from either of drivers. What do you think?
Michal
I started refactoring this commit to have shared methods between qemu
and ch drviers for cgroup management. While doing so, I realized, I
still need a mechanism to identify what the underlying driver is : ch/qemu.
An example of it is the prefix for the cgroup to be created. Ch driver
is configured to have a prefix of "ch", while qemu driver configures the
prefix of the cgroup name to "qemu".
What is the best way to detect the underlying driver from
src/hypervisor? One way I could think of it is to extend
virQEMUDriver/virtCHDriver struct to also have a driver name which will
be checked from these shared methods. Any other recommendations for this
check?
--
Regards,
Praveen K Paladugu