all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] pve6to7: add check for 'lxc.cgroup.' keys in container config
Date: Wed,  7 Jul 2021 10:44:19 +0200	[thread overview]
Message-ID: <20210707084419.2264646-1-s.ivanov@proxmox.com> (raw)

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>
---
Tested quickly by pasting the lxc.cgroup.devices keys from the thread into a
container config.

PVE/CLI/pve6to7.pm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/PVE/CLI/pve6to7.pm b/PVE/CLI/pve6to7.pm
index 629d6935..a4a0bc67 100644
--- a/PVE/CLI/pve6to7.pm
+++ b/PVE/CLI/pve6to7.pm
@@ -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') };
@@ -1090,6 +1114,7 @@ sub check_misc {
     check_custom_pool_roles();
     check_description_lengths();
     check_storage_content();
+    check_lxc_conf_keys();
 }
 
 __PACKAGE__->register_method ({
-- 
2.30.2





             reply	other threads:[~2021-07-07  8:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07  8:44 Stoiko Ivanov [this message]
2021-07-07 10:46 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210707084419.2264646-1-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal