[pve-devel] [PATCH qemu-server 1/3] add PVE::QemuServer::Cgroup

Alexandre Derumier aderumier at odiso.com
Fri Oct 30 10:42:34 CET 2020


---
 PVE/QemuServer/CGroup.pm | 25 +++++++++++++++++++++++++
 PVE/QemuServer/Makefile  |  1 +
 2 files changed, 26 insertions(+)
 create mode 100644 PVE/QemuServer/CGroup.pm

diff --git a/PVE/QemuServer/CGroup.pm b/PVE/QemuServer/CGroup.pm
new file mode 100644
index 0000000..7ca0826
--- /dev/null
+++ b/PVE/QemuServer/CGroup.pm
@@ -0,0 +1,25 @@
+package PVE::QemuServer::CGroup;
+
+use strict;
+use warnings;
+use PVE::CGroup;
+use base('PVE::CGroup');
+
+sub get_subdir {
+    my ($self, $controller, $limiting) = @_;
+
+    my $entry_name = $controller || 'unified';
+    my $entry = ($self->{controllers}->{$entry_name} //= {});
+
+    my $kind = $limiting ? 'limit' : 'ns';
+    my $path = $entry->{$kind};
+
+    return $path if defined $path;
+
+    my $vmid = $self->{vmid};
+    $path = "qemu.slice/$vmid.scope/";
+
+    return $path;
+}
+
+1;
diff --git a/PVE/QemuServer/Makefile b/PVE/QemuServer/Makefile
index fd8cfbb..e4ed184 100644
--- a/PVE/QemuServer/Makefile
+++ b/PVE/QemuServer/Makefile
@@ -9,6 +9,7 @@ SOURCES=PCI.pm		\
 	Monitor.pm	\
 	Machine.pm	\
 	CPUConfig.pm	\
+	CGroup.pm	\
 	Drive.pm	\
 
 .PHONY: install
-- 
2.20.1





More information about the pve-devel mailing list