From a26e1abc70e087a7f42e8197ef080222990a680f Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 12 May 2017 11:56:07 +0200 Subject: [PATCH] free: added snapshot parameter --- PVE/API2/Storage/Content.pm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/PVE/API2/Storage/Content.pm b/PVE/API2/Storage/Content.pm index f159600..20c2eda 100644 --- a/PVE/API2/Storage/Content.pm +++ b/PVE/API2/Storage/Content.pm @@ -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; }});