]> git.proxmox.com Git - qemu-server.git/commitdiff
Fix #2171: vm_start: volid based statefiles were not activated
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 17 Oct 2019 17:13:01 +0000 (19:13 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 18 Nov 2019 18:57:10 +0000 (19:57 +0100)
So, while we could just make this a special case before the
config_to_command call and set the $conf->{vmstate} to the statefile
for the case were it's a valid volumeid, the special case handling
get's much easier when we do this outside of that method.

So it's basically a trade-off, and after looking far to long at all
nice revisions Alwin made for me and Fabians request, and even trying
out different approaches, it was never perfect.

But having slight code duplication over the movement mess I proposed
(as I did not had the full picture then, sorry Alwin) felt like the
slightly nicer trade off, as all worked I just use this one now, it
has very clear semantics, easy to understand and that now three lines
are duplicated is IMO irrelevant.

Co-developed-by: Alwin Antreich <a.antreich@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
(cherry picked from commit 5c1d42b7f825fa124ff3701b32f9ecc011bece95)
[squashed the two fixups from master into this one]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/QemuConfig.pm
PVE/QemuServer.pm

index 84d601aecf47693a36419004edfd0c30552428b5..f6a7f538345438dc9f08a154707a4ed80d50b295 100644 (file)
@@ -359,8 +359,7 @@ sub __snapshot_rollback_vm_start {
     my ($class, $vmid, $vmstate, $data) = @_;
 
     my $storecfg = PVE::Storage::config();
-    my $statefile = PVE::Storage::path($storecfg, $vmstate);
-    PVE::QemuServer::vm_start($storecfg, $vmid, $statefile, undef, undef, undef, $data->{forcemachine});
+    PVE::QemuServer::vm_start($storecfg, $vmid, $vmstate, undef, undef, undef, $data->{forcemachine});
 }
 
 sub __snapshot_rollback_get_unused {
index 3238216d908729b99ee01e7575c704c8d3e1e21f..60a377c7b71b86c3e28f8011fbdb0a3bbce443f2 100644 (file)
@@ -4001,7 +4001,7 @@ sub config_to_command {
 
     if (my $vmstate = $conf->{vmstate}) {
        my $statepath = PVE::Storage::path($storecfg, $vmstate);
-       push @$vollist, $statepath;
+       push @$vollist, $vmstate;
        push @$cmd, '-loadstate', $statepath;
     }
 
@@ -5277,8 +5277,12 @@ sub vm_start {
                push @$cmd, '-incoming', $migrate_uri;
                push @$cmd, '-S';
 
-           } else {
+           } elsif (-e $statefile) {
                push @$cmd, '-loadstate', $statefile;
+           } else {
+               my $statepath = PVE::Storage::path($storecfg, $statefile);
+               push @$vollist, $statefile;
+               push @$cmd, '-loadstate', $statepath;
            }
        } elsif ($paused) {
            push @$cmd, '-S';