api: clone: extend error message by volume ID

So far, the error message only contained the name of the disk
(tpmstate0, efidisk0, ...), which can also lead to the assumption that a
specific disk type is the problem. Now the volume ID is primarily
listed.

Example:
 # qm clone 101 102 --full --snapname foo

Before:
> Full clone feature is not supported for drive 'tpmstate0'

After:
> Full clone feature is not supported for 'local-zfs:base-100-disk-2/vm-101-disk-2' (tpmstate0)

Signed-off-by: Alexander Zeidler <a.zeidler@proxmox.com>
This commit is contained in:
Alexander Zeidler 2024-12-04 11:30:03 +01:00 committed by Fiona Ebner
parent 081c5de3d6
commit a1140f00b9

View File

@ -3899,18 +3899,19 @@ __PACKAGE__->register_method({
if (PVE::QemuServer::drive_is_cdrom($drive, 1)) { if (PVE::QemuServer::drive_is_cdrom($drive, 1)) {
$newconf->{$opt} = $value; # simply copy configuration $newconf->{$opt} = $value; # simply copy configuration
} else { } else {
my $volid = $drive->{file};
if ($full || PVE::QemuServer::drive_is_cloudinit($drive)) { if ($full || PVE::QemuServer::drive_is_cloudinit($drive)) {
die "Full clone feature is not supported for drive '$opt'\n" die "Full clone feature is not supported for '$volid' ($opt)\n"
if !PVE::Storage::volume_has_feature($storecfg, 'copy', $drive->{file}, $snapname, $running); if !PVE::Storage::volume_has_feature($storecfg, 'copy', $volid, $snapname, $running);
$fullclone->{$opt} = 1; $fullclone->{$opt} = 1;
} else { } else {
# not full means clone instead of copy # not full means clone instead of copy
die "Linked clone feature is not supported for drive '$opt'\n" die "Linked clone feature is not supported for '$volid' ($opt)\n"
if !PVE::Storage::volume_has_feature($storecfg, 'clone', $drive->{file}, $snapname, $running); if !PVE::Storage::volume_has_feature($storecfg, 'clone', $volid, $snapname, $running);
} }
$drives->{$opt} = $drive; $drives->{$opt} = $drive;
next if PVE::QemuServer::drive_is_cloudinit($drive); next if PVE::QemuServer::drive_is_cloudinit($drive);
push @$vollist, $drive->{file}; push @$vollist, $volid;
} }
} else { } else {
# copy everything else # copy everything else