[pve-devel] [PATCH storage 1/3] import: add -delete-snapshot parameter
Wolfgang Bumiller
w.bumiller at proxmox.com
Wed May 24 15:40:14 CEST 2017
This deletes a snapshot on *success*, done directly in the
CLI handler, as the rollback/delete on failure is already
happening inside the plugin's import method.
---
Actually wanted to send this series yesterday already...
PVE/CLI/pvesm.pm | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/PVE/CLI/pvesm.pm b/PVE/CLI/pvesm.pm
index ba2c91b..7f5748f 100755
--- a/PVE/CLI/pvesm.pm
+++ b/PVE/CLI/pvesm.pm
@@ -258,6 +258,13 @@ __PACKAGE__->register_method ({
optional => 1,
default => 0,
},
+ 'delete-snapshot' => {
+ description => "A snapshot to delete on success",
+ type => 'string',
+ pattern => qr/[a-z0-9_\-]{1,40}/,
+ maxLength => 40,
+ optional => 1,
+ },
},
},
returns => { type => 'null' },
@@ -275,8 +282,12 @@ __PACKAGE__->register_method ({
}
my $cfg = PVE::Storage::config();
- PVE::Storage::volume_import($cfg, $infh, $param->{volume}, $param->{format},
+ my $volume = $param->{volume};
+ my $delete = $param->{'delete-snapshot'};
+ PVE::Storage::volume_import($cfg, $infh, $volume, $param->{format},
$param->{base}, $param->{'with-snapshots'});
+ PVE::Storage::volume_snapshot_delete($cfg, $volume, $delete)
+ if defined($delete);
return;
}
});
--
2.11.0
More information about the pve-devel
mailing list