plugin|lvmplugin: don't allow volume rename if external snapshots exist.
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.derumier@groupe-cyllene.com>
This commit is contained in:
committed by
Wolfgang Bumiller
parent
44b4e42552
commit
f649f5a99c
@ -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;
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user