[pve-devel] [PATCH qemu-server 1/3] image convert: avoid combining target image options and zeroinit filter
Fiona Ebner
f.ebner at proxmox.com
Wed Jul 30 17:03:15 CEST 2025
Would fail with an error
> Block format 'qcow2' does not support the option 'zeroinit:driver'
for a qcow2 target on a directory storage with
'snapshot-as-volume-chain'.
Reported-by: Friedrich Weber <f.weber at proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
src/PVE/QemuServer/QemuImage.pm | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/PVE/QemuServer/QemuImage.pm b/src/PVE/QemuServer/QemuImage.pm
index bbfb4fd6..8fe75e92 100644
--- a/src/PVE/QemuServer/QemuImage.pm
+++ b/src/PVE/QemuServer/QemuImage.pm
@@ -109,11 +109,12 @@ sub convert {
push @$cmd, '-f', $src_format;
}
+ my $dst_uses_target_image_opts = $dst_is_iscsi || $dst_needs_discard_no_unref;
+ push @$cmd, '--target-image-opts' if $dst_uses_target_image_opts;
+
if ($dst_is_iscsi) {
- push @$cmd, '--target-image-opts';
$dst_path = convert_iscsi_path($dst_path);
} elsif ($dst_needs_discard_no_unref) {
- push @$cmd, '--target-image-opts';
$dst_path = qcow2_target_image_opts($dst_path, 'discard-no-unref=true');
} else {
push @$cmd, '-O', $dst_format;
@@ -121,7 +122,7 @@ sub convert {
push @$cmd, $src_path;
- if (!$dst_is_iscsi && $opts->{'is-zero-initialized'}) {
+ if (!$dst_uses_target_image_opts && $opts->{'is-zero-initialized'}) {
push @$cmd, "zeroinit:$dst_path";
} else {
push @$cmd, $dst_path;
--
2.47.2
More information about the pve-devel
mailing list