[pve-devel] [PATCH storage 2/6] pvesm: add delsnapshot command
Wolfgang Bumiller
w.bumiller at proxmox.com
Thu May 11 09:36:16 CEST 2017
---
PVE/CLI/pvesm.pm | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/PVE/CLI/pvesm.pm b/PVE/CLI/pvesm.pm
index 728233a..0439768 100755
--- a/PVE/CLI/pvesm.pm
+++ b/PVE/CLI/pvesm.pm
@@ -271,6 +271,40 @@ __PACKAGE__->register_method ({
}
});
+__PACKAGE__->register_method ({
+ name => 'delsnapshot',
+ path => 'delsnapshot',
+ method => 'GET',
+ description => "Delete a snapshot (this should not be used by hand).",
+ protected => 1,
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ volume => {
+ description => "Volume identifier",
+ type => 'string',
+ completion => \&PVE::Storage::complete_volume,
+ },
+ snapshot => {
+ description => "Snapshot to export",
+ type => 'string',
+ optional => 1,
+ },
+ },
+ },
+ returns => { type => 'null' },
+ code => sub {
+ my ($param) = @_;
+
+ my $volume = $param->{volume};
+ my $snapshot = $param->{snapshot};
+
+ my $cfg = PVE::Storage::config();
+ PVE::Storage::volume_snapshot_delete($cfg, $param->{volume}, $param->{snapshot}, 0);
+ return;
+ }
+});
+
our $cmddef = {
add => [ "PVE::API2::Storage::Config", 'create', ['type', 'storage'] ],
set => [ "PVE::API2::Storage::Config", 'update', ['storage'] ],
@@ -346,6 +380,7 @@ our $cmddef = {
extractconfig => [__PACKAGE__, 'extractconfig', ['volume']],
export => [ __PACKAGE__, 'export', ['volume', 'format', 'filename']],
import => [ __PACKAGE__, 'import', ['volume', 'format', 'filename']],
+ delsnapshot => [ __PACKAGE__, 'delsnapshot', ['volume', 'snapshot']],
};
1;
--
2.11.0
More information about the pve-devel
mailing list