[pve-devel] [PATCH qemu-server 3/3] api: clone: mention "snapshot" in the error message if specified

Alexander Zeidler a.zeidler at proxmox.com
Wed Dec 4 11:30:04 CET 2024


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 at proxmox.com>
---
 PVE/API2/Qemu.pm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 661cf1e9..df1776a6 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -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;
-- 
2.39.5





More information about the pve-devel mailing list