From: Lorenz Stechauner <l.stechauner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] pve6to7: add check for guest and node description length
Date: Fri, 18 Jun 2021 15:30:33 +0200 [thread overview]
Message-ID: <20210618133033.3940947-1-l.stechauner@proxmox.com> (raw)
Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
---
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
reply other threads:[~2021-06-18 13:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210618133033.3940947-1-l.stechauner@proxmox.com \
--to=l.stechauner@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox