--- Begin Message ---
Just to safe, as this is already check higher in the stack.
Technically, it's possible to implement snapshot file renaming,
and update backing_file info with "qemu-img rebase -u".
Signed-off-by: Alexandre Derumier <alexandre.derum...@groupe-cyllene.com>
---
src/PVE/Storage/LVMPlugin.pm | 6 ++++++
src/PVE/Storage/Plugin.pm | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm
index 9aadbc2..8a61bc5 100644
--- a/src/PVE/Storage/LVMPlugin.pm
+++ b/src/PVE/Storage/LVMPlugin.pm
@@ -1233,6 +1233,12 @@ sub rename_volume {
my (
undef, $source_image, $source_vmid, $base_name, $base_vmid, undef,
$format,
) = $class->parse_volname($source_volname);
+
+ if ($format eq 'qcow2') {
+ my $snapshots = $class->volume_snapshot_info($scfg, $storeid,
$source_volname);
+ die "we can't rename volume if external snapshot exists" if
$snapshots->{current}->{parent};
+ }
+
$target_volname = $class->find_free_diskname($storeid, $scfg,
$target_vmid, $format)
if !$target_volname;
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index 06d258e..8ea62e4 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -2175,6 +2175,11 @@ sub rename_volume {
die "not implemented in storage plugin '$class'\n" if $class->can('api')
&& $class->api() < 10;
die "no path found\n" if !$scfg->{path};
+ if ($scfg->{'external-snapshots'}) {
+ my $snapshots = $class->volume_snapshot_info($scfg, $storeid,
$source_volname);
+ die "we can't rename volume if external snapshot exists" if
$snapshots->{current}->{parent};
+ }
+
my (
undef, $source_image, $source_vmid, $base_name, $base_vmid, undef,
$format,
) = $class->parse_volname($source_volname);
--
2.39.5
--- End Message ---
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel