]> git.proxmox.com Git - pve-manager.git/commitdiff
pve6to7: add check for 'lxc.cgroup.' keys in container config
authorStoiko Ivanov <s.ivanov@proxmox.com>
Wed, 7 Jul 2021 08:44:19 +0000 (10:44 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 7 Jul 2021 12:21:39 +0000 (14:21 +0200)
The check is rather straight forward - and might help users who
passthrough devices to their containers.

Reported in our community forum:
https://forum.proxmox.com/threads/pve-7-0-lxc-intel-quick-sync-passtrough-not-working-anymore.92025/

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
(cherry picked from commit 4cc5130b5678123135ae82ceb96e9c6da6fe1248)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/CLI/pve6to7.pm

index 69ed6d2e28fae370dbb986155ab483ac51eedf9e..93456876361e1108d2f1f42bc0123edf9a62a5d7 100644 (file)
@@ -995,6 +995,30 @@ sub check_containers_cgroup_compat {
     }
 };
 
+sub check_lxc_conf_keys {
+    my $kernel_cli = PVE::Tools::file_get_contents('/proc/cmdline');
+    if ($kernel_cli =~ /systemd.unified_cgroup_hierarchy=0/){
+       log_skip("System explicitly configured for legacy hybrid cgroup hierarchy.");
+       return;
+    }
+
+    log_info("Checking container configs for deprecated lxc.cgroup entries");
+
+    my $affected_ct = [];
+    my $cts = PVE::LXC::config_list();
+    for my $vmid (sort { $a <=> $b } keys %$cts) {
+       my $lxc_raw_conf = PVE::LXC::Config->load_config($vmid)->{lxc};
+       push @$affected_ct, "CT $vmid"  if (grep (@$_[0] =~ /^lxc\.cgroup\./, @$lxc_raw_conf));
+    }
+    if (scalar($affected_ct->@*) > 0) {
+       log_warn("Config of the following containers contains 'lxc.cgroup' keys, which will be ".
+           "ignored in a unified cgroupv2 system:\n" .
+           join(", ", $affected_ct->@*));
+    } else {
+       log_pass("No legacy 'lxc.cgroup' keys found.");
+    }
+}
+
 sub check_misc {
     print_header("MISCELLANEOUS CHECKS");
     my $ssh_config = eval { PVE::Tools::file_get_contents('/root/.ssh/config') };
@@ -1097,6 +1121,7 @@ sub check_misc {
     check_custom_pool_roles();
     check_description_lengths();
     check_storage_content();
+    check_lxc_conf_keys();
 }
 
 __PACKAGE__->register_method ({