]> git.proxmox.com Git - qemu-server.git/blobdiff - PVE/API2/Qemu.pm
pass 'digest', so that GUI can detect changes easily
[qemu-server.git] / PVE / API2 / Qemu.pm
index 047b1063420a607f97751016e2c1b1cc0b4cb65a..5d69ca33f194876ff3c78879084855e552929422 100644 (file)
@@ -1925,14 +1925,14 @@ __PACKAGE__->register_method({
                description => $d->{description} || '',
            };
            $item->{parent} = $d->{parent} if $d->{parent};
+           $item->{snapstate} = $d->{snapstate} if $d->{snapstate};
            push @$res, $item;
        }
 
-       if ($conf->{parent}) {
-           push @$res, { name => '__current', parent => $conf->{parent} };
-       } else {
-           push @$res, { name => '__current' };
-       }
+       my $current = { name => 'current', digest => $conf->{digest} };
+       $current->{parent} = $conf->{parent} if $conf->{parent};
+
+       push @$res, $current;
 
        return $res;
     }});
@@ -1987,6 +1987,9 @@ __PACKAGE__->register_method({
 
        my $snapname = extract_param($param, 'snapname');
 
+       die "unable to use snapshot name 'current' (reserved name)\n"
+           if $snapname eq 'current';
+
        my $realcmd = sub {
            PVE::Cluster::log_msg('info', $authuser, "snapshot VM $vmid: $snapname");
            PVE::QemuServer::snapshot_create($vmid, $snapname, $param->{vmstate}, 
@@ -2185,6 +2188,11 @@ __PACKAGE__->register_method({
            node => get_standard_option('pve-node'),
            vmid => get_standard_option('pve-vmid'),
            snapname => get_standard_option('pve-snapshot-name'),
+           force => {
+               optional => 1,
+               type => 'boolean',
+               description => "For removal from config file, even if removing disk snapshots fails.",
+           },
        },
     },
     returns => {
@@ -2206,7 +2214,7 @@ __PACKAGE__->register_method({
 
        my $realcmd = sub {
            PVE::Cluster::log_msg('info', $authuser, "delete snapshot VM $vmid: $snapname");
-           PVE::QemuServer::snapshot_delete($vmid, $snapname);
+           PVE::QemuServer::snapshot_delete($vmid, $snapname, $param->{force});
        };
 
        return $rpcenv->fork_worker('qmdelsnapshot', $vmid, $authuser, $realcmd);