If already upgraded, the suggestion to stop or migrate running guests
is wrong.

Signed-off-by: Fiona Ebner <f.eb...@proxmox.com>
---
 PVE/CLI/pve8to9.pm | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/PVE/CLI/pve8to9.pm b/PVE/CLI/pve8to9.pm
index 994189f1..35785891 100644
--- a/PVE/CLI/pve8to9.pm
+++ b/PVE/CLI/pve8to9.pm
@@ -1985,22 +1985,26 @@ sub check_rrd_migration {
 sub check_virtual_guests {
     print_header("VIRTUAL GUEST CHECKS");
 
-    log_info("Checking for running guests..");
-    my $running_guests = 0;
+    if (!$upgraded) {
+        log_info("Checking for running guests..");
+        my $running_guests = 0;
 
-    my $local_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' } @$local_vms if 
defined($local_vms);
+        my $local_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' } @$local_vms if 
defined($local_vms);
 
-    my $local_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' } @$local_cts if 
defined($local_cts);
+        my $local_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' } @$local_cts if 
defined($local_cts);
 
-    if ($running_guests > 0) {
-        log_warn(
-            "$running_guests running guest(s) detected - consider migrating or 
stopping them.");
+        if ($running_guests > 0) {
+            log_warn(
+                "$running_guests running guest(s) detected - consider 
migrating or stopping them.");
+        } else {
+            log_pass("no running guest detected.");
+        }
     } else {
-        log_pass("no running guest detected.");
+        log_skip("Skipping check for running guests - already upgraded.");
     }
 
     check_lxcfs_fuse_version();
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to