]> git.proxmox.com Git - pve-storage.git/commitdiff
free: added snapshot parameter
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 12 May 2017 09:56:07 +0000 (11:56 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 12 May 2017 12:42:16 +0000 (14:42 +0200)
PVE/API2/Storage/Content.pm

index f15960039823eea32e6b31e3aec397bb0f967f03..20c2eda86b9281e766c7afb485b5056c6eb26d08 100644 (file)
@@ -258,6 +258,12 @@ __PACKAGE__->register_method ({
                type => 'string',
                completion => \&PVE::Storage::complete_volume,
            },
+           snapshot => {
+               description => "Delete a snapshot instead of the entire disk.",
+               type => 'string',
+               pattern => qr/[a-z0-9_\-]{1,40}/,
+               optional => 1,
+           }
        },
     },
     returns => { type => 'null' },
@@ -279,7 +285,12 @@ __PACKAGE__->register_method ({
            $rpcenv->check($authuser, "/storage/$storeid", ['Datastore.Allocate']);
        }
 
-       PVE::Storage::vdisk_free ($cfg, $volid);
+       my $snapshot = $param->{snapshot};
+       if (defined($snapshot)) {
+           PVE::Storage::volume_snapshot_delete($cfg, $volid, $snapshot, 0);
+       } else {
+           PVE::Storage::vdisk_free($cfg, $volid);
+       }
 
        return undef;
     }});