public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Jakob Klocker <j.klocker@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Jakob Klocker <j.klocker@proxmox.com>
Subject: [PATCH storage] fix #7598: qemu-img resize: tolerate timeout if resize succeeded
Date: Wed,  3 Jun 2026 10:25:57 +0200	[thread overview]
Message-ID: <20260603082557.25359-1-j.klocker@proxmox.com> (raw)

On slow storages there is a chance the 10 second timeout is triggered
when resizing a volume. If the timeout fires while the resize is in a
certain state near the end, the operation can still complete
successfully even though a timeout error is thrown. In that case the
config is never updated and keeps the old, wrong size.

Because the config is out of sync, the volume is then displayed with
the wrong size in the web interface.

Link: https://bugzilla.proxmox.com/show_bug.cgi?id=7598
Signed-off-by: Jakob Klocker <j.klocker@proxmox.com>
---
 src/PVE/Storage/Common.pm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Storage/Common.pm b/src/PVE/Storage/Common.pm
index 3932aee..ee2ea00 100644
--- a/src/PVE/Storage/Common.pm
+++ b/src/PVE/Storage/Common.pm
@@ -277,7 +277,17 @@ sub qemu_img_resize {
     push $cmd->@*, '-f', $format, $path, $size;
 
     $timeout = 10 if !$timeout;
-    run_command($cmd, timeout => $timeout);
+    eval { run_command($cmd, timeout => $timeout); };
+    if (my $err = $@) {
+
+        die $err if $err !~ /got timeout/;
+
+        my $info = JSON::decode_json(qemu_img_info($path, $format));
+        die $err if !$info;
+
+        my $actual_size = $info->{'virtual-size'};
+        die $err if !defined($actual_size) || $actual_size < $size;
+    }
 }
 
 1;
-- 
2.47.3




                 reply	other threads:[~2026-06-03  8:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260603082557.25359-1-j.klocker@proxmox.com \
    --to=j.klocker@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