[pve-devel] [PATCH pve-container 2/3] use PVE::CGroup

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


---
 src/PVE/LXC.pm            | 7 ++++---
 src/lxc-pve-prestart-hook | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 9c150d9..5cfcf28 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -33,6 +33,7 @@ use PVE::GuestHelpers qw(safe_string_ne safe_num_ne safe_boolean_ne);
 use PVE::LXC::Tools;
 use PVE::LXC::CGroup;
 use PVE::LXC::Monitor;
+use PVE::CGroup;
 
 use Time::HiRes qw (gettimeofday);
 my $have_sdn;
@@ -402,9 +403,9 @@ sub parse_ipv4_cidr {
     die "unable to parse ipv4 address/mask\n";
 }
 
-# Deprecated. Use `PVE::LXC::CGroup::get_cgroup_controllers()` instead.
+# Deprecated. Use `PVE::CGroup::get_cgroup_controllers()` instead.
 sub get_cgroup_subsystems {
-    PVE::LXC::CGroup::get_v1_controllers();
+    PVE::CGroup::get_v1_controllers();
 }
 
 # With seccomp trap to userspace we now have the ability to optionally forward
@@ -708,7 +709,7 @@ sub update_lxc_config {
     }
 
     my $cpuset;
-    my ($cpuset_cgroup, $cpuset_version) = eval { PVE::LXC::CGroup::cpuset_controller_path() };
+    my ($cpuset_cgroup, $cpuset_version) = eval { PVE::CGroup::cpuset_controller_path() };
     if (defined($cpuset_cgroup)) {
 	$cpuset = eval { PVE::CpuSet->new_from_path("$cpuset_cgroup/lxc", 1) }
 	    || PVE::CpuSet->new_from_path($cpuset_cgroup, 1);
diff --git a/src/lxc-pve-prestart-hook b/src/lxc-pve-prestart-hook
index 8823cad..40d58c4 100755
--- a/src/lxc-pve-prestart-hook
+++ b/src/lxc-pve-prestart-hook
@@ -144,7 +144,7 @@ PVE::LXC::Tools::lxc_hook('pre-start', 'lxc', sub {
 sub cleanup_cgroups($) {
     my ($vmid) = @_;
 
-    if (PVE::LXC::CGroup::cgroup_mode() == 2) {
+    if (PVE::CGroup::cgroup_mode() == 2) {
 	rmdir_recursive("/sys/fs/cgroup/lxc/$vmid");
 	rmdir_recursive("/sys/fs/cgroup/lxc.monitor/$vmid");
     } else {
-- 
2.20.1





More information about the pve-devel mailing list