api: clone: mention "snapshot" in the error message if specified

as it may be the only cause of the clone incompatibility

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

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

After:
> Full clone feature is not supported for a snapshot of '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:04 +01:00 committed by Fiona Ebner
parent a1140f00b9
commit 0250b7f52f

View File

@ -3900,13 +3900,16 @@ __PACKAGE__->register_method({
$newconf->{$opt} = $value; # simply copy configuration
} else {
my $volid = $drive->{file};
my $msg = "clone feature is not supported for";
$msg .= " a snapshot of" if $snapname;
$msg .= " '$volid' ($opt)";
if ($full || PVE::QemuServer::drive_is_cloudinit($drive)) {
die "Full clone feature is not supported for '$volid' ($opt)\n"
die "Full $msg\n"
if !PVE::Storage::volume_has_feature($storecfg, 'copy', $volid, $snapname, $running);
$fullclone->{$opt} = 1;
} else {
# not full means clone instead of copy
die "Linked clone feature is not supported for '$volid' ($opt)\n"
die "Linked $msg\n"
if !PVE::Storage::volume_has_feature($storecfg, 'clone', $volid, $snapname, $running);
}
$drives->{$opt} = $drive;