public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 1/3] image convert: avoid combining target image options and zeroinit filter
Date: Wed, 30 Jul 2025 17:03:15 +0200	[thread overview]
Message-ID: <20250730150325.138087-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20250730150325.138087-1-f.ebner@proxmox.com>

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@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@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



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  reply	other threads:[~2025-07-30 15:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30 15:03 [pve-devel] [PATCH-SERIES qemu-server 0/3] image convert: fix handling qcow2 on snapshot-as-volume-chain dir target Fiona Ebner
2025-07-30 15:03 ` Fiona Ebner [this message]
2025-07-30 15:03 ` [pve-devel] [PATCH qemu-server 2/3] image convert: re-use generate_drive_blockdev() Fiona Ebner
2025-07-30 15:03 ` [pve-devel] [PATCH qemu-server 3/3] image convert: make using zeroinit with target-image-opts work Fiona Ebner
2025-07-30 22:23 ` [pve-devel] applied: [PATCH-SERIES qemu-server 0/3] image convert: fix handling qcow2 on snapshot-as-volume-chain dir target Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250730150325.138087-2-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal