From b6c10c63927dbd73df8c46da84c94a5c239292e2 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Tue, 2 Jul 2019 12:09:34 +0200 Subject: [PATCH] pve5to6: be a bit more verbose for misc. checks Signed-off-by: Thomas Lamprecht --- PVE/CLI/pve5to6.pm | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/PVE/CLI/pve5to6.pm b/PVE/CLI/pve5to6.pm index 328ecab1..83c715e4 100644 --- a/PVE/CLI/pve5to6.pm +++ b/PVE/CLI/pve5to6.pm @@ -447,18 +447,24 @@ sub check_misc { log_warn("Less than 2G free space on root file system.") if defined($root_free) && $root_free->{avail} < 2*1024*1024*1024; + log_info("Checking for running guests.."); my $running_guests = 0; + my $vms = eval { PVE::API2::Qemu->vmlist({ node => $nodename }) }; log_warn("Failed to retrieve information about this node's VMs - $@") if $@; - $running_guests += grep { $_->{status} eq 'running' } @$vms - if defined($vms); + $running_guests += grep { $_->{status} eq 'running' } @$vms if defined($vms); + my $cts = eval { PVE::API2::LXC->vmlist({ node => $nodename }) }; log_warn("Failed to retrieve information about this node's CTs - $@") if $@; - $running_guests += grep { $_->{status} eq 'running' } @$cts - if defined($cts); - log_warn("$running_guests running guests detected - consider migrating/stopping them.") - if $running_guests > 0; + $running_guests += grep { $_->{status} eq 'running' } @$cts if defined($cts); + if ($running_guests > 0) { + log_warn("$running_guests running guest(s) detected - consider migrating or stopping them.") + } else { + log_pass("no running guest detected.") + } + + log_info("Checking if we the local nodes address is resolvable and configured.."); my $host = PVE::INotify::nodename(); my $local_ip = eval { PVE::Network::get_ip_from_hostname($host) }; if ($@) { @@ -472,6 +478,8 @@ sub check_misc { log_fail("Resolved node IP '$local_ip' not configured or active for '$host'"); } elsif ($ip_count > 1) { log_warn("Resolved node IP '$local_ip' active on multiple ($ip_count) interfaces!"); + } else { + log_pass("Could resolved local nodename '$host' to active IP '$local_ip'"); } }