]> git.proxmox.com Git - qemu-server.git/commitdiff
explain 'nocheck' in more places
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 21 Nov 2022 12:16:05 +0000 (13:16 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 21 Nov 2022 12:42:52 +0000 (13:42 +0100)
was only explained in git history and vm_stop, add comments in other
relevant places to avoid future breakage.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
PVE/API2/Qemu.pm
PVE/CLI/qm.pm
PVE/QemuMigrate.pm
PVE/QemuServer.pm

index 6bdcce216164c2050fcbf2c7fbb5940b0357f26b..badfc37bb6269768305c4cf0070ae1307ba336b6 100644 (file)
@@ -3200,6 +3200,8 @@ __PACKAGE__->register_method({
        raise_param_exc({ skiplock => "Only root may use this option." })
            if $skiplock && $authuser ne 'root@pam';
 
+       # nocheck is used as part of migration when config file might be still
+       # be on source node
        my $nocheck = extract_param($param, 'nocheck');
        raise_param_exc({ nocheck => "Only root may use this option." })
            if $nocheck && $authuser ne 'root@pam';
index 66feeccebea89ac16e0dbece53663daad4b4e62b..3e0f128931511af33e96c0bd1b5ce946ab7be44d 100755 (executable)
@@ -426,6 +426,8 @@ __PACKAGE__->register_method ({
                last;
            } elsif ($line =~ /^resume (\d+)$/) {
                my $vmid = $1;
+               # check_running and vm_resume with nocheck, since local node
+               # might not have processed config move/rename yet
                if (PVE::QemuServer::check_running($vmid, 1)) {
                    eval { PVE::QemuServer::vm_resume($vmid, 1, 1); };
                    if ($@) {
index 5941cce66689266b4b85f89daad0dc0a6b81647c..5e466d954cb21d3b3c30d41dfc6ed1b77b765b51 100644 (file)
@@ -1500,6 +1500,7 @@ sub phase3_cleanup {
                    $self->{errors} = 1;
                }
            } else {
+               # nocheck in case target node hasn't processed the config move/rename yet
                my $cmd = [@{$self->{rem_ssh}}, 'qm', 'resume', $vmid, '--skiplock', '--nocheck'];
                my $logf = sub {
                    my $line = shift;
@@ -1561,7 +1562,7 @@ sub phase3_cleanup {
        }
     };
 
-    # always stop local VM
+    # always stop local VM with nocheck, since config is moved already
     eval { PVE::QemuServer::vm_stop($self->{storecfg}, $vmid, 1, 1); };
     if (my $err = $@) {
        $self->log('err', "stopping vm failed - $err");
index caaf1a5a8bdad57ee0001667de6eb93e30cd8251..a746b3ddaf4fd1c0253303eaf4e953ff225572e4 100644 (file)
@@ -2788,6 +2788,12 @@ sub check_local_storage_availability {
 sub check_running {
     my ($vmid, $nocheck, $node) = @_;
 
+    # $nocheck is set when called during a migration, in which case the config
+    # file might still or already reside on the *other* node
+    # - because rename has already happened, and current node is source
+    # - because rename hasn't happened yet, and current node is target
+    # - because rename has happened, current node is target, but hasn't yet
+    # processed it yet
     PVE::QemuConfig::assert_config_exists_on_node($vmid, $node) if !$nocheck;
     return PVE::QemuServer::Helpers::vm_running_locally($vmid);
 }
@@ -6359,6 +6365,9 @@ sub vm_suspend {
     }
 }
 
+# $nocheck is set when called as part of a migration - in this context the
+# location of the config file (source or target node) is not deterministic,
+# since migration cannot wait for pmxcfs to process the rename
 sub vm_resume {
     my ($vmid, $skiplock, $nocheck) = @_;