1 package PVE
::CLI
::pve6to7
;
10 use PVE
::API2
::Certificates
;
12 use PVE
::AccessControl
;
19 use PVE
::RPCEnvironment
;
21 use PVE
::Storage
::Plugin
;
22 use PVE
::Tools
qw(run_command split_list);
25 use PVE
::VZDump
::Common
;
31 use base
qw(PVE::CLIHandler);
33 my $nodename = PVE
::INotify
::nodename
();
35 sub setup_environment
{
36 PVE
::RPCEnvironment-
>setup_default_cli_env();
39 my $min_pve_major = 6;
40 my $min_pve_minor = 4;
41 my $min_pve_pkgrel = 1;
51 my ($level, $line) = @_;
53 $counters->{$level}++ if defined($level) && defined($counters->{$level});
55 print uc($level), ': ' if defined($level);
61 $log_line->('pass', @_);
66 $log_line->('info', @_);
69 $log_line->('skip', @_);
72 print color
('yellow');
73 $log_line->('warn', @_);
78 $log_line->('fail', @_);
82 my $print_header_first = 1;
85 print "\n" if !$print_header_first;
87 $print_header_first = 0;
90 my $get_systemd_unit_state = sub {
94 my $filter_output = sub {
99 run_command
(['systemctl', 'is-enabled', "$unit"], outfunc
=> $filter_output, noerr
=> 1);
100 return if !defined($state);
101 run_command
(['systemctl', 'is-active', "$unit"], outfunc
=> $filter_output, noerr
=> 1);
104 return $state // 'unknown';
106 my $log_systemd_unit_state = sub {
107 my ($unit, $no_fail_on_inactive) = @_;
109 my $log_method = \
&log_warn
;
111 my $state = $get_systemd_unit_state->($unit);
112 if ($state eq 'active') {
113 $log_method = \
&log_pass
;
114 } elsif ($state eq 'inactive') {
115 $log_method = $no_fail_on_inactive ? \
&log_warn
: \
&log_fail
;
116 } elsif ($state eq 'failed') {
117 $log_method = \
&log_fail
;
120 $log_method->("systemd unit '$unit' is in state '$state'");
127 $versions = eval { PVE
::API2
::APT-
>versions({ node
=> $nodename }) } if !defined($versions);
129 if (!defined($versions)) {
130 my $msg = "unable to retrieve package version information";
131 $msg .= "- $@" if $@;
136 my $pkgs = [ grep { $_->{Package
} eq $pkg } @$versions ];
137 if (!defined $pkgs || $pkgs == 0) {
138 log_fail
("unable to determine installed $pkg version.");
145 sub check_pve_packages
{
146 print_header
("CHECKING VERSION INFORMATION FOR PVE PACKAGES");
148 print "Checking for package updates..\n";
149 my $updates = eval { PVE
::API2
::APT-
>list_updates({ node
=> $nodename }); };
150 if (!defined($updates)) {
151 log_warn
("$@") if $@;
152 log_fail
("unable to retrieve list of package updates!");
153 } elsif (@$updates > 0) {
154 my $pkgs = join(', ', map { $_->{Package
} } @$updates);
155 log_warn
("updates for the following packages are available:\n $pkgs");
157 log_pass
("all packages uptodate");
160 print "\nChecking proxmox-ve package version..\n";
161 if (defined(my $proxmox_ve = $get_pkg->('proxmox-ve'))) {
162 my $min_pve_ver = "$min_pve_major.$min_pve_minor-$min_pve_pkgrel";
164 my ($maj, $min, $pkgrel) = $proxmox_ve->{OldVersion
} =~ m/^(\d+)\.(\d+)-(\d+)/;
168 if ($maj > $min_pve_major) {
169 log_pass
("already upgraded to Proxmox VE " . ($min_pve_major + 1));
171 } elsif ($maj >= $min_pve_major && $min >= $min_pve_minor && $pkgrel >= $min_pve_pkgrel) {
172 log_pass
("proxmox-ve package has version >= $min_pve_ver");
174 log_fail
("proxmox-ve package is too old, please upgrade to >= $min_pve_ver!");
177 my ($krunning, $kinstalled) = (qr/5\.11/, 'pve-kernel-5.11');
179 ($krunning, $kinstalled) = (qr/5\.(?:4|11)/, 'pve-kernel-4.15');
182 print "\nChecking running kernel version..\n";
183 my $kernel_ver = $proxmox_ve->{RunningKernel
};
184 if (!defined($kernel_ver)) {
185 log_fail
("unable to determine running kernel version.");
186 } elsif ($kernel_ver =~ /^$krunning/) {
187 log_pass
("expected running kernel '$kernel_ver'.");
188 } elsif ($get_pkg->($kinstalled)) {
189 log_warn
("expected kernel '$kinstalled' intalled but not yet rebooted!");
191 log_warn
("unexpected running and installed kernel '$kernel_ver'.");
194 log_fail
("proxmox-ve package not found!");
199 sub check_storage_health
{
200 print_header
("CHECKING CONFIGURED STORAGES");
201 my $cfg = PVE
::Storage
::config
();
205 my $info = PVE
::Storage
::storage_info
($cfg);
207 foreach my $storeid (keys %$info) {
208 my $d = $info->{$storeid};
210 if ($d->{type
} eq 'sheepdog') {
211 log_fail
("storage '$storeid' of type 'sheepdog' is enabled - experimental sheepdog support dropped in PVE 6")
212 } elsif ($d->{active
}) {
213 log_pass
("storage '$storeid' enabled and active.");
215 log_warn
("storage '$storeid' enabled but not active!");
218 log_skip
("storage '$storeid' disabled.");
223 sub check_cluster_corosync
{
224 print_header
("CHECKING CLUSTER HEALTH/SETTINGS");
226 if (!PVE
::Corosync
::check_conf_exists
(1)) {
227 log_skip
("standalone node.");
231 $log_systemd_unit_state->('pve-cluster.service');
232 $log_systemd_unit_state->('corosync.service');
234 if (PVE
::Cluster
::check_cfs_quorum
(1)) {
235 log_pass
("Cluster Filesystem is quorate.");
237 log_fail
("Cluster Filesystem readonly, lost quorum?!");
240 my $conf = PVE
::Cluster
::cfs_read_file
('corosync.conf');
241 my $conf_nodelist = PVE
::Corosync
::nodelist
($conf);
244 print "\nAnalzying quorum settings and state..\n";
245 if (!defined($conf_nodelist)) {
246 log_fail
("unable to retrieve nodelist from corosync.conf");
248 if (grep { $conf_nodelist->{$_}->{quorum_votes
} != 1 } keys %$conf_nodelist) {
249 log_warn
("non-default quorum_votes distribution detected!");
251 map { $node_votes += $conf_nodelist->{$_}->{quorum_votes
} // 0 } keys %$conf_nodelist;
254 my ($expected_votes, $total_votes);
255 my $filter_output = sub {
257 ($expected_votes) = $line =~ /^Expected votes:\s*(\d+)\s*$/
258 if !defined($expected_votes);
259 ($total_votes) = $line =~ /^Total votes:\s*(\d+)\s*$/
260 if !defined($total_votes);
263 run_command
(['corosync-quorumtool', '-s'], outfunc
=> $filter_output, noerr
=> 1);
266 if (!defined($expected_votes)) {
267 log_fail
("unable to get expected number of votes, setting to 0.");
270 if (!defined($total_votes)) {
271 log_fail
("unable to get expected number of votes, setting to 0.");
275 my $cfs_nodelist = PVE
::Cluster
::get_clinfo
()->{nodelist
};
276 my $offline_nodes = grep { $cfs_nodelist->{$_}->{online
} != 1 } keys %$cfs_nodelist;
277 if ($offline_nodes > 0) {
278 log_fail
("$offline_nodes nodes are offline!");
281 my $qdevice_votes = 0;
282 if (my $qdevice_setup = $conf->{main
}->{quorum
}->{device
}) {
283 $qdevice_votes = $qdevice_setup->{votes
} // 1;
286 log_info
("configured votes - nodes: $node_votes");
287 log_info
("configured votes - qdevice: $qdevice_votes");
288 log_info
("current expected votes: $expected_votes");
289 log_info
("current total votes: $total_votes");
291 log_warn
("expected votes set to non-standard value '$expected_votes'.")
292 if $expected_votes != $node_votes + $qdevice_votes;
293 log_warn
("total votes < expected votes: $total_votes/$expected_votes!")
294 if $total_votes < $expected_votes;
296 my $conf_nodelist_count = scalar(keys %$conf_nodelist);
297 my $cfs_nodelist_count = scalar(keys %$cfs_nodelist);
298 log_warn
("cluster consists of less than three quorum-providing nodes!")
299 if $conf_nodelist_count < 3 && $conf_nodelist_count + $qdevice_votes < 3;
301 log_fail
("corosync.conf ($conf_nodelist_count) and pmxcfs ($cfs_nodelist_count) don't agree about size of nodelist.")
302 if $conf_nodelist_count != $cfs_nodelist_count;
304 print "\nChecking nodelist entries..\n";
305 for my $cs_node (sort keys %$conf_nodelist) {
306 my $entry = $conf_nodelist->{$cs_node};
307 log_fail
("$cs_node: no name entry in corosync.conf.")
308 if !defined($entry->{name
});
309 log_fail
("$cs_node: no nodeid configured in corosync.conf.")
310 if !defined($entry->{nodeid
});
312 for my $link (0..7) {
313 $gotLinks++ if defined($entry->{"ring${link}_addr"});
315 log_fail
("$cs_node: no ringX_addr (0 <= X <= 7) link defined in corosync.conf.") if $gotLinks <= 0;
317 my $verify_ring_ip = sub {
319 if (defined(my $ring = $entry->{$key})) {
320 my ($resolved_ip, undef) = PVE
::Corosync
::resolve_hostname_like_corosync
($ring, $conf);
321 if (defined($resolved_ip)) {
322 if ($resolved_ip ne $ring) {
323 log_warn
("$cs_node: $key '$ring' resolves to '$resolved_ip'.\n Consider replacing it with the currently resolved IP address.");
325 log_pass
("$cs_node: $key is configured to use IP address '$ring'");
328 log_fail
("$cs_node: unable to resolve $key '$ring' to an IP address according to Corosync's resolve strategy - cluster will potentially fail with Corosync 3.x/kronosnet!");
332 for my $link (0..7) {
333 $verify_ring_ip->("ring${link}_addr");
337 print "\nChecking totem settings..\n";
338 my $totem = $conf->{main
}->{totem
};
339 my $transport = $totem->{transport
};
340 if (defined($transport)) {
341 if ($transport ne 'knet') {
342 log_fail
("Corosync transport explicitly set to '$transport' instead of implicit default!");
344 log_pass
("Corosync transport set to '$transport'.");
347 log_pass
("Corosync transport set to implicit default.");
350 # TODO: are those values still up-to-date?
351 if ((!defined($totem->{secauth
}) || $totem->{secauth
} ne 'on') && (!defined($totem->{crypto_cipher
}) || $totem->{crypto_cipher
} eq 'none')) {
352 log_fail
("Corosync authentication/encryption is not explicitly enabled (secauth / crypto_cipher / crypto_hash)!");
354 if (defined($totem->{crypto_cipher
}) && $totem->{crypto_cipher
} eq '3des') {
355 log_fail
("Corosync encryption cipher set to '3des', no longer supported in Corosync 3.x!"); # FIXME: can be removed?
357 log_pass
("Corosync encryption and authentication enabled.");
362 log_info
("run 'pvecm status' to get detailed cluster status..");
364 print_header
("CHECKING INSTALLED COROSYNC VERSION");
365 if (defined(my $corosync = $get_pkg->('corosync'))) {
366 if ($corosync->{OldVersion
} =~ m/^2\./) {
367 log_fail
("corosync 2.x installed, cluster-wide upgrade to 3.x needed!");
368 } elsif ($corosync->{OldVersion
} =~ m/^3\./) {
369 log_pass
("corosync 3.x installed.");
371 log_fail
("unexpected corosync version installed: $corosync->{OldVersion}!");
377 print_header
("CHECKING HYPER-CONVERGED CEPH STATUS");
379 if (PVE
::Ceph
::Tools
::check_ceph_inited
(1)) {
380 log_info
("hyper-converged ceph setup detected!");
382 log_skip
("no hyper-converged ceph setup detected!");
386 log_info
("getting Ceph status/health information..");
387 my $ceph_status = eval { PVE
::API2
::Ceph-
>status({ node
=> $nodename }); };
388 my $osd_flags = eval { PVE
::API2
::Ceph-
>get_flags({ node
=> $nodename }); };
389 my $noout_wanted = 1;
390 my $noout = $osd_flags && $osd_flags =~ m/noout/;
392 if (!$ceph_status || !$ceph_status->{health
}) {
393 log_fail
("unable to determine Ceph status!");
395 my $ceph_health = $ceph_status->{health
}->{status
};
397 log_fail
("unable to determine Ceph health!");
398 } elsif ($ceph_health eq 'HEALTH_OK') {
399 log_pass
("Ceph health reported as 'HEALTH_OK'.");
400 } elsif ($ceph_health eq 'HEALTH_WARN' && $noout && (keys %{$ceph_status->{health
}->{checks
}} == 1)) {
401 log_pass
("Ceph health reported as 'HEALTH_WARN' with a single failing check and 'noout' flag set.");
403 log_warn
("Ceph health reported as '$ceph_health'.\n Use the PVE ".
404 "dashboard or 'ceph -s' to determine the specific issues and try to resolve them.");
408 log_info
("getting Ceph OSD flags..");
411 log_fail
("unable to get Ceph OSD flags!");
413 if ($osd_flags =~ m/recovery_deletes/ && $osd_flags =~ m/purged_snapdirs/) {
414 log_pass
("all PGs have been scrubbed at least once while running Ceph Luminous."); # FIXME: remove?
416 log_fail
("missing 'recovery_deletes' and/or 'purged_snapdirs' flag, scrub of all PGs required before upgrading to Nautilus!");
421 # TODO: check OSD min-required version, if to low it breaks stuff!
423 log_info
("getting Ceph daemon versions..");
424 my $ceph_versions = eval { PVE
::Ceph
::Tools
::get_cluster_versions
(undef, 1); };
425 if (!$ceph_versions) {
426 log_fail
("unable to determine Ceph daemon versions!");
429 { 'key' => 'mon', 'name' => 'monitor' },
430 { 'key' => 'mgr', 'name' => 'manager' },
431 { 'key' => 'mds', 'name' => 'MDS' },
432 { 'key' => 'osd', 'name' => 'OSD' },
435 foreach my $service (@$services) {
436 my $name = $service->{name
};
437 if (my $service_versions = $ceph_versions->{$service->{key
}}) {
438 if (keys %$service_versions == 0) {
439 log_skip
("no running instances detected for daemon type $name.");
440 } elsif (keys %$service_versions == 1) {
441 log_pass
("single running version detected for daemon type $name.");
443 log_warn
("multiple running versions detected for daemon type $name!");
446 log_skip
("unable to determine versions of running Ceph $name instances.");
450 my $overall_versions = $ceph_versions->{overall
};
451 if (!$overall_versions) {
452 log_warn
("unable to determine overall Ceph daemon versions!");
453 } elsif (keys %$overall_versions == 1) {
454 log_pass
("single running overall version detected for all Ceph daemon types.");
455 if ((keys %$overall_versions)[0] =~ /^ceph version 15\./) {
459 log_warn
("overall version mismatch detected, check 'ceph versions' output for details!");
465 log_pass
("'noout' flag set to prevent rebalancing during cluster-wide upgrades.");
467 log_warn
("'noout' flag set, Ceph cluster upgrade seems finished.");
469 } elsif ($noout_wanted) {
470 log_warn
("'noout' flag not set - recommended to prevent rebalancing during upgrades.");
473 log_info
("checking Ceph config..");
474 my $conf = PVE
::Cluster
::cfs_read_file
('ceph.conf');
476 my $global = $conf->{global
};
478 my $global_monhost = $global->{mon_host
} // $global->{"mon host"} // $global->{"mon-host"};
479 if (!defined($global_monhost)) {
480 log_warn
("No 'mon_host' entry found in ceph config.\n It's recommended to add mon_host with all monitor addresses (without ports) to the global section.");
482 log_pass
("Found 'mon_host' entry.");
485 my $ipv6 = $global->{ms_bind_ipv6
} // $global->{"ms bind ipv6"} // $global->{"ms-bind-ipv6"};
487 my $ipv4 = $global->{ms_bind_ipv4
} // $global->{"ms bind ipv4"} // $global->{"ms-bind-ipv4"};
488 if ($ipv6 eq 'true' && (!defined($ipv4) || $ipv4 ne 'false')) {
489 log_warn
("'ms_bind_ipv6' is enabled but 'ms_bind_ipv4' is not disabled.\n Make sure to disable 'ms_bind_ipv4' for ipv6 only clusters, or add an ipv4 network to public/cluster network.");
491 log_pass
("'ms_bind_ipv6' is enabled and 'ms_bind_ipv4' disabled");
494 log_pass
("'ms_bind_ipv6' not enabled");
497 if (defined($global->{keyring
})) {
498 log_warn
("[global] config section contains 'keyring' option, which will prevent services from starting with Nautilus.\n Move 'keyring' option to [client] section instead.");
500 log_pass
("no 'keyring' option in [global] section found.");
504 log_warn
("Empty ceph config found");
507 my $local_ceph_ver = PVE
::Ceph
::Tools
::get_local_version
(1);
508 if (defined($local_ceph_ver)) {
509 if ($local_ceph_ver == 14) {
510 my $ceph_volume_osds = PVE
::Ceph
::Tools
::ceph_volume_list
();
511 my $scanned_osds = PVE
::Tools
::dir_glob_regex
('/etc/ceph/osd', '^.*\.json$');
512 if (-e
'/var/lib/ceph/osd/' && !defined($scanned_osds) && !(keys %$ceph_volume_osds)) {
513 log_warn
("local Ceph version is Nautilus, local OSDs detected, but no conversion from ceph-disk to ceph-volume done (yet).");
517 log_fail
("unable to determine local Ceph version.");
521 sub check_backup_retention_settings
{
522 log_info
("Checking backup retention settings..");
526 my $node_has_retention;
528 my $maxfiles_msg = "parameter 'maxfiles' is deprecated with PVE 7.x and will be removed in a " .
529 "future version, use 'prune-backups' instead.";
532 my $confdesc = PVE
::VZDump
::Common
::get_confdesc
();
534 my $fn = "/etc/vzdump.conf";
535 my $raw = PVE
::Tools
::file_get_contents
($fn);
537 my $conf_schema = { type
=> 'object', properties
=> $confdesc, };
538 my $param = PVE
::JSONSchema
::parse_config
($conf_schema, $fn, $raw);
540 if (defined($param->{maxfiles
})) {
542 log_warn
("$fn - $maxfiles_msg");
545 $node_has_retention = defined($param->{maxfiles
}) || defined($param->{'prune-backups'});
549 log_warn
("unable to parse node's VZDump configuration - $err");
552 my $storage_cfg = PVE
::Storage
::config
();
554 for my $storeid (keys $storage_cfg->{ids
}->%*) {
555 my $scfg = $storage_cfg->{ids
}->{$storeid};
557 if (defined($scfg->{maxfiles
})) {
559 log_warn
("storage '$storeid' - $maxfiles_msg");
562 next if !$scfg->{content
}->{backup
};
563 next if defined($scfg->{maxfiles
}) || defined($scfg->{'prune-backups'});
564 next if $node_has_retention;
566 log_info
("storage '$storeid' - no backup retention settings defined - by default, PVE " .
567 "7.x will no longer keep only the last backup, but all backups");
571 my $vzdump_cron = PVE
::Cluster
::cfs_read_file
('vzdump.cron');
573 # only warn once, there might be many jobs...
574 if (scalar(grep { defined($_->{maxfiles
}) } $vzdump_cron->{jobs
}->@*)) {
576 log_warn
("/etc/pve/vzdump.cron - $maxfiles_msg");
581 log_warn
("unable to parse node's VZDump configuration - $err");
584 log_pass
("no problems found.") if $pass;
587 sub check_cifs_credential_location
{
588 log_info
("checking CIFS credential location..");
590 my $regex = qr/^(.*)\.cred$/;
594 PVE
::Tools
::dir_glob_foreach
('/etc/pve/priv/', $regex, sub {
597 my ($basename) = $filename =~ $regex;
599 log_warn
("CIFS credentials '/etc/pve/priv/$filename' will be moved to " .
600 "'/etc/pve/priv/storage/$basename.pw' during the update");
605 log_pass
("no CIFS credentials at outdated location found.") if !$found;
608 sub check_custom_pool_roles
{
609 log_info
("Checking custom roles for pool permissions..");
611 my $raw = eval { PVE
::Tools
::file_get_contents
('/etc/pve/user.cfg'); };
613 log_fail
("Failed to read '/etc/pve/user.cfg' - $@");
618 while ($raw =~ /^\s*(.+?)\s*$/gm) {
622 foreach my $d (split (/:/, $line)) {
628 my $et = shift @data;
629 next if $et ne 'role';
631 my ($role, $privlist) = @data;
632 if (!PVE
::AccessControl
::verify_rolename
($role, 1)) {
633 warn "user config - ignore role '$role' - invalid characters in role name\n";
637 $roles->{$role} = {} if !$roles->{$role};
638 foreach my $priv (split_list
($privlist)) {
639 $roles->{$role}->{$priv} = 1;
643 foreach my $role (sort keys %{$roles}) {
644 if (PVE
::AccessControl
::role_is_special
($role)) {
648 if ($role eq "PVEPoolUser") {
649 # the user created a custom role named PVEPoolUser
650 log_fail
("Custom role '$role' has a restricted name - a built-in role 'PVEPoolUser' will be available with the upgrade");
652 log_pass
("Custom role '$role' has no restricted name");
655 my $perms = $roles->{$role};
656 if ($perms->{'Pool.Allocate'} && $perms->{'Pool.Audit'}) {
657 log_pass
("Custom role '$role' contains updated pool permissions");
658 } elsif ($perms->{'Pool.Allocate'}) {
659 log_warn
("Custom role '$role' contains permission 'Pool.Allocate' - to ensure same behavior add 'Pool.Audit' to this role");
661 log_pass
("Custom role '$role' contains no permissions that need to be updated");
666 my sub check_max_length
{
667 my ($raw, $max_length, $warning) = @_;
668 log_warn
($warning) if defined($raw) && length($raw) > $max_length;
671 sub check_description_lengths
{
672 log_info
("Checking node and guest description/note legnth..");
674 my @affected_nodes = grep {
675 my $desc = PVE
::NodeConfig
::load_config
($_)->{desc
};
676 defined($desc) && length($desc) > 64 * 1024
677 } PVE
::Cluster
::get_nodelist
();
679 if (scalar(@affected_nodes) > 0) {
680 log_warn
("Node config description of the following nodes too long for new limit of 64 KiB:\n "
681 . join(', ', @affected_nodes));
683 log_pass
("All node config descriptions fit in the new limit of 64 KiB");
686 my $affected_guests = [];
688 my $cts = PVE
::LXC
::config_list
();
689 for my $vmid (sort { $a <=> $b } keys %$cts) {
690 my $desc = PVE
::LXC
::Config-
>load_config($vmid)->{description
};
691 push @$affected_guests, "CT $vmid" if defined($desc) && length($desc) > 8 * 1024;
693 my $vms = PVE
::QemuServer
::config_list
();
694 for my $vmid (sort { $a <=> $b } keys %$vms) {
695 my $desc = PVE
::QemuConfig-
>load_config($vmid)->{description
};
696 push @$affected_guests, "VM $vmid" if defined($desc) && length($desc) > 8 * 1024;
698 if (scalar($affected_guests->@*) > 0) {
699 log_warn
("Node config description of the following nodes too long for new limit of 64 KiB:\n"
700 ." * " . join("\n * ", $affected_guests->@*));
702 log_pass
("All guest config descriptions fit in the new limit of 8 KiB");
706 sub check_storage_content
{
707 log_info
("Checking storage content type configuration..");
711 my $storage_cfg = PVE
::Storage
::config
();
713 for my $storeid (keys $storage_cfg->{ids
}->%*) {
714 my $scfg = $storage_cfg->{ids
}->{$storeid};
716 next if !PVE
::Storage
::storage_check_enabled
($storage_cfg, $storeid, undef, 1);
718 my $valid_content = PVE
::Storage
::Plugin
::valid_content_types
($scfg->{type
});
720 if (scalar(keys $scfg->{content
}->%*) == 0 && !$valid_content->{none
}) {
721 log_fail
("storage '$storeid' does not support configured content type 'none'");
722 delete $scfg->{content
}->{none
}; # scan for guest images below
725 next if $scfg->{content
}->{images
};
726 next if $scfg->{content
}->{rootdir
};
728 # Skip 'iscsi(direct)' (and foreign plugins with potentially similiar behavior) with 'none',
729 # because that means "use LUNs directly" and vdisk_list() in PVE 6.x still lists those.
730 # It's enough to *not* skip 'dir', because it is the only other storage that supports 'none'
731 # and 'images' or 'rootdir', hence being potentially misconfigured.
732 next if $scfg->{type
} ne 'dir' && $scfg->{content
}->{none
};
734 my $res = PVE
::Storage
::vdisk_list
($storage_cfg, $storeid);
735 my $disk_list = $res->{$storeid};
737 my @volumes = map { $_->{volid
} } $disk_list->@*;
739 if (scalar(@volumes) > 0) {
741 log_warn
("storage '$storeid' - neither content type 'images' nor 'rootdir' " .
742 "configured, but found guest volume(s) " . join(',', @volumes));
747 log_warn
("PVE 7.0 enforces stricter content type checks. Guests referencing the above " .
748 "volumes will not work until the storage configuration is fixed.");
750 log_pass
("no problems found");
755 print_header
("MISCELLANEOUS CHECKS");
756 my $ssh_config = eval { PVE
::Tools
::file_get_contents
('/root/.ssh/config') };
757 if (defined($ssh_config)) {
758 log_fail
("Unsupported SSH Cipher configured for root in /root/.ssh/config: $1")
759 if $ssh_config =~ /^Ciphers .*(blowfish|arcfour|3des).*$/m;
761 log_skip
("No SSH config file found.");
764 log_info
("Checking common daemon services..");
765 $log_systemd_unit_state->('pveproxy.service');
766 $log_systemd_unit_state->('pvedaemon.service');
767 $log_systemd_unit_state->('pvestatd.service');
769 my $root_free = PVE
::Tools
::df
('/', 10);
770 log_warn
("Less than 4 GiB free space on root file system.")
771 if defined($root_free) && $root_free->{avail
} < 4*1024*1024*1024;
773 log_info
("Checking for running guests..");
774 my $running_guests = 0;
776 my $vms = eval { PVE
::API2
::Qemu-
>vmlist({ node
=> $nodename }) };
777 log_warn
("Failed to retrieve information about this node's VMs - $@") if $@;
778 $running_guests += grep { $_->{status
} eq 'running' } @$vms if defined($vms);
780 my $cts = eval { PVE
::API2
::LXC-
>vmlist({ node
=> $nodename }) };
781 log_warn
("Failed to retrieve information about this node's CTs - $@") if $@;
782 $running_guests += grep { $_->{status
} eq 'running' } @$cts if defined($cts);
784 if ($running_guests > 0) {
785 log_warn
("$running_guests running guest(s) detected - consider migrating or stopping them.")
787 log_pass
("no running guest detected.")
790 log_info
("Checking if the local node's hostname '$nodename' is resolvable..");
791 my $local_ip = eval { PVE
::Network
::get_ip_from_hostname
($nodename) };
793 log_warn
("Failed to resolve hostname '$nodename' to IP - $@");
795 log_info
("Checking if resolved IP is configured on local node..");
796 my $cidr = Net
::IP
::ip_is_ipv6
($local_ip) ?
"$local_ip/128" : "$local_ip/32";
797 my $configured_ips = PVE
::Network
::get_local_ip_from_cidr
($cidr);
798 my $ip_count = scalar(@$configured_ips);
800 if ($ip_count <= 0) {
801 log_fail
("Resolved node IP '$local_ip' not configured or active for '$nodename'");
802 } elsif ($ip_count > 1) {
803 log_warn
("Resolved node IP '$local_ip' active on multiple ($ip_count) interfaces!");
805 log_pass
("Resolved node IP '$local_ip' configured and active on single interface.");
809 log_info
("Check node certificate's RSA key size");
810 my $certs = PVE
::API2
::Certificates-
>info({ node
=> $nodename });
816 'id-ecPublicKey' => {
822 my $certs_check_failed = 0;
823 foreach my $cert (@$certs) {
824 my ($type, $size, $fn) = $cert->@{qw(public-key-type public-key-bits filename)};
826 if (!defined($type) || !defined($size)) {
827 log_warn
("'$fn': cannot check certificate, failed to get it's type or size!");
830 my $check = $certs_check->{$type};
831 if (!defined($check)) {
832 log_warn
("'$fn': certificate's public key type '$type' unknown, check Debian Busters release notes");
836 if ($size < $check->{minsize
}) {
837 log_fail
("'$fn', certificate's $check->{name} public key size is less than 2048 bit");
838 $certs_check_failed = 1;
840 log_pass
("Certificate '$fn' passed Debian Busters security level for TLS connections ($size >= 2048)");
844 check_backup_retention_settings
();
845 check_cifs_credential_location
();
846 check_custom_pool_roles
();
847 check_description_lengths
();
848 check_storage_content
();
851 __PACKAGE__-
>register_method ({
855 description
=> 'Check (pre-/post-)upgrade conditions.',
857 additionalProperties
=> 0,
861 returns
=> { type
=> 'null' },
865 check_pve_packages
();
866 check_cluster_corosync
();
868 check_storage_health
();
871 print_header
("SUMMARY");
874 $total += $_ for values %$counters;
876 print "TOTAL: $total\n";
877 print colored
("PASSED: $counters->{pass}\n", 'green');
878 print "SKIPPED: $counters->{skip}\n";
879 print colored
("WARNINGS: $counters->{warn}\n", 'yellow');
880 print colored
("FAILURES: $counters->{fail}\n", 'red');
882 if ($counters->{warn} > 0 || $counters->{fail
} > 0) {
883 my $color = $counters->{fail
} > 0 ?
'red' : 'yellow';
884 print colored
("\nATTENTION: Please check the output for detailed information!\n", $color);
885 print colored
("Try to solve the problems one at a time and then run this checklist tool again.\n", $color) if $counters->{fail
} > 0;
891 our $cmddef = [ __PACKAGE__
, 'checklist', [], {}];
893 # for now drop all unknown params and just check