diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 3eabddd5..78f2236c 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -4365,9 +4365,6 @@ __PACKAGE__->register_method({ } elsif ($storeid) { $rpcenv->check($authuser, "/storage/$storeid", ['Datastore.AllocateSpace']); - die "cannot move disk '$disk', only configured disks can be moved to another storage\n" - if $disk =~ m/^unused\d+$/; - $load_and_check_move->(); # early checks before forking/locking my $realcmd = sub { diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 24aaa942..661613df 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -8154,7 +8154,8 @@ sub clone_disk { my ($newvmid, $dst_drivename, $efisize) = $dest->@{qw(vmid drivename efisize)}; my ($storage, $format) = $dest->@{qw(storage format)}; - my $use_drive_mirror = $full && $running && $src_drivename && !$snapname; + my $unused = $src_drivename =~ /^unused/; + my $use_drive_mirror = $full && $running && $src_drivename && !$snapname && !$unused; if ($src_drivename && $dst_drivename && $src_drivename ne $dst_drivename) { die "cloning from/to EFI disk requires EFI disk\n" @@ -8260,7 +8261,7 @@ no_data_clone: my $disk = dclone($drive); delete $disk->{format}; $disk->{file} = $newvolid; - $disk->{size} = $size if defined($size); + $disk->{size} = $size if defined($size) && !$unused; return $disk; }