mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-14 06:17:23 +00:00
template_create: check for 'clone' feature
This commit is contained in:
parent
3e2bbcdc0e
commit
9cd0784249
@ -4409,7 +4409,7 @@ sub snapshot_delete {
|
|||||||
lock_config($vmid, $updatefn);
|
lock_config($vmid, $updatefn);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub has_feature{
|
sub has_feature {
|
||||||
my ($feature, $conf, $storecfg, $snapname, $running) = @_;
|
my ($feature, $conf, $storecfg, $snapname, $running) = @_;
|
||||||
|
|
||||||
my $err = undef;
|
my $err = undef;
|
||||||
@ -4433,6 +4433,20 @@ sub template_create {
|
|||||||
my $storecfg = PVE::Storage::config();
|
my $storecfg = PVE::Storage::config();
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
|
|
||||||
|
# First check if all disks have feature 'clone'.
|
||||||
|
# Note: there is no feature 'create_base', but we can safely assume
|
||||||
|
# that a storage with feature 'clone' can create base images.
|
||||||
|
foreach_drive($conf, sub {
|
||||||
|
my ($ds, $drive) = @_;
|
||||||
|
|
||||||
|
return if drive_is_cdrom($drive);
|
||||||
|
return if $disk && $ds ne $disk;
|
||||||
|
|
||||||
|
my $volid = $drive->{file};
|
||||||
|
die "volume '$volid' does not support template/clone\n"
|
||||||
|
if !PVE::Storage::volume_has_feature($storecfg, 'clone', $volid);
|
||||||
|
});
|
||||||
|
|
||||||
foreach_drive($conf, sub {
|
foreach_drive($conf, sub {
|
||||||
my ($ds, $drive) = @_;
|
my ($ds, $drive) = @_;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user