]> git.proxmox.com Git - qemu-server.git/commitdiff
followup code cleanup
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 30 Jan 2019 14:08:15 +0000 (15:08 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 30 Jan 2019 14:08:15 +0000 (15:08 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/API2/Qemu.pm
PVE/QemuServer.pm

index b94dd1225bf0970c5af0c27cb3cd163a21ddcfad..984052c908b472436898608b5985480e5d752b7a 100644 (file)
@@ -854,14 +854,12 @@ __PACKAGE__->register_method({
 
        my $conf = PVE::QemuConfig->load_config($param->{vmid});
 
-       my $snapname = $param->{snapshot};
-       if ($snapname) {
+       if (my $snapname = $param->{snapshot}) {
            my $snapshot = $conf->{snapshots}->{$snapname};
-           die "snapshot '$snapname' does not exist\n"
-               if !defined($snapshot);
+           die "snapshot '$snapname' does not exist\n" if !defined($snapshot);
+
+           $snapshot->{digest} = $conf->{digest}; # keep file digest for API
 
-           # we need the digest of the file
-           $snapshot->{digest} = $conf->{digest};
            $conf = $snapshot;
        }
 
index 3b642863fce715d55b66d3393fa48f480e71071b..32f52fe2b0714e94769b6a146ae9baf406a0cc05 100644 (file)
@@ -5378,12 +5378,10 @@ sub vm_commandline {
 
     if ($snapname) {
        my $snapshot = $conf->{snapshots}->{$snapname};
-       die "snapshot '$snapname' does not exist\n"
-           if !defined($snapshot);
-       my $digest = $conf->{digest};
+       die "snapshot '$snapname' does not exist\n" if !defined($snapshot);
+
+       $snapshot->{digest} = $conf->{digest}; # keep file digest for API
 
-       # we need the digest of the file
-       $snapshot->{digest} = $conf->{digest};
        $conf = $snapshot;
     }