From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 6C618738F7 for ; Fri, 18 Jun 2021 15:31:08 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 53F7C874F for ; Fri, 18 Jun 2021 15:30:38 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id C71848736 for ; Fri, 18 Jun 2021 15:30:37 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 8EEFA44228 for ; Fri, 18 Jun 2021 15:30:37 +0200 (CEST) From: Lorenz Stechauner To: pve-devel@lists.proxmox.com Date: Fri, 18 Jun 2021 15:30:33 +0200 Message-Id: <20210618133033.3940947-1-l.stechauner@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.790 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [pve6to7.pm] Subject: [pve-devel] [PATCH manager] pve6to7: add check for guest and node description length X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jun 2021 13:31:08 -0000 Signed-off-by: Lorenz Stechauner --- PVE/CLI/pve6to7.pm | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/PVE/CLI/pve6to7.pm b/PVE/CLI/pve6to7.pm index fc779e4f..5238175e 100644 --- a/PVE/CLI/pve6to7.pm +++ b/PVE/CLI/pve6to7.pm @@ -15,9 +15,11 @@ use PVE::Cluster; use PVE::Corosync; use PVE::INotify; use PVE::JSONSchema; +use PVE::NodeConfig; use PVE::RPCEnvironment; use PVE::Storage; use PVE::Tools qw(run_command split_list); +use PVE::QemuConfig; use PVE::QemuServer; use PVE::VZDump::Common; @@ -660,6 +662,40 @@ sub check_custom_pool_roles { } } +sub check_description_lengths { + log_info("Checking node and guest description/note legnth.."); + + my $nodes = PVE::Cluster::get_nodelist();; + foreach my $node (@$nodes) { + my $conf = PVE::NodeConfig::load_config($node); + my $desc = $conf->{description}; + next if !defined($desc); + if (length($desc) > 64 * 1024) { + log_warn("Description of node $node is too long! - maximum will be 64k"); + } + } + + my $lxcs = PVE::LXC::vmstatus(); + foreach my $vmid (keys %$lxcs) { + my $conf = PVE::LXC::Config->load_config($vmid); + my $desc = $conf->{description}; + next if !defined($desc); + if (length($desc) > 8 * 1024) { + log_warn("Description of guest $vmid is too long! - maximum will be 8k"); + } + } + + my $vms = PVE::QemuServer::vmstatus(); + foreach my $vmid (keys %$vms) { + my $conf = PVE::QemuConfig->load_config($vmid); + my $desc = $conf->{description}; + next if !defined($desc); + if (length($desc) > 8 * 1024) { + log_warn("Description of guest $vmid is too long! - maximum will be 8k"); + } + } +} + sub check_misc { print_header("MISCELLANEOUS CHECKS"); my $ssh_config = eval { PVE::Tools::file_get_contents('/root/.ssh/config') }; @@ -753,6 +789,7 @@ sub check_misc { check_backup_retention_settings(); check_cifs_credential_location(); check_custom_pool_roles(); + check_description_lengths(); } __PACKAGE__->register_method ({ -- 2.30.2