public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH v2 manager] pve6to7: add check for guest and node description length
@ 2021-06-18 13:34 Lorenz Stechauner
  2021-06-18 14:52 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Lorenz Stechauner @ 2021-06-18 13:34 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
---
changes to v1:
* using ::config_list() instead of ::vmstatus()

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

diff --git a/PVE/CLI/pve6to7.pm b/PVE/CLI/pve6to7.pm
index fc779e4f..f9433028 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::config_list();
+    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::config_list();
+    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





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-18 14:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18 13:34 [pve-devel] [PATCH v2 manager] pve6to7: add check for guest and node description length Lorenz Stechauner
2021-06-18 14:52 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal