* [PATCH pve-storage v3 1/2] qemu-img: drop redundant timeout argument at resize call
2026-08-11 7:37 [PATCH storage v3 0/2] fix #7598: qemu-img: increase timeout for image resize Jakob Klocker
@ 2026-08-11 7:37 ` Jakob Klocker
2026-08-13 9:04 ` Elias Huhsovitz
2026-08-11 7:37 ` [PATCH pve-storage v3 2/2] fix #7598: qemu-img: increase timeout for image resizing in worker context Jakob Klocker
2026-09-18 8:29 ` applied: [PATCH storage v3 0/2] fix #7598: qemu-img: increase timeout for image resize Fiona Ebner
2 siblings, 1 reply; 6+ messages in thread
From: Jakob Klocker @ 2026-08-11 7:37 UTC (permalink / raw)
To: pve-devel; +Cc: Jakob Klocker
`qemu_img_resize` already defaults to a timeout of 10 seconds when none
is passed, so passing 10 explicitly is redundant.
Signed-off-by: Jakob Klocker <j.klocker@proxmox.com>
---
src/PVE/Storage/LVMPlugin.pm | 2 +-
src/PVE/Storage/Plugin.pm | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm
index b8646c2..768ff95 100644
--- a/src/PVE/Storage/LVMPlugin.pm
+++ b/src/PVE/Storage/LVMPlugin.pm
@@ -1081,7 +1081,7 @@ sub volume_resize {
if (!$running && $format eq 'qcow2') {
my $preallocation = PVE::Storage::Plugin::preallocation_cmd_opt($scfg, $format);
- PVE::Storage::Common::qemu_img_resize($path, $format, $size, $preallocation, 10);
+ PVE::Storage::Common::qemu_img_resize($path, $format, $size, $preallocation);
}
return 1;
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index 4f69f9b..082355d 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -1373,7 +1373,7 @@ sub volume_resize {
my $format = ($class->parse_volname($volname))[6];
my $preallocation = preallocation_cmd_opt($scfg, $format);
- PVE::Storage::Common::qemu_img_resize($path, $format, $size, $preallocation, 10);
+ PVE::Storage::Common::qemu_img_resize($path, $format, $size, $preallocation);
return undef;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH pve-storage v3 1/2] qemu-img: drop redundant timeout argument at resize call
2026-08-11 7:37 ` [PATCH pve-storage v3 1/2] qemu-img: drop redundant timeout argument at resize call Jakob Klocker
@ 2026-08-13 9:04 ` Elias Huhsovitz
0 siblings, 0 replies; 6+ messages in thread
From: Elias Huhsovitz @ 2026-08-13 9:04 UTC (permalink / raw)
To: Jakob Klocker, pve-devel
Last patch (v2) I also didn't consider that thrid-party plugins would
call qemu_img_resize. Therefore keeping the $timeout parameter is
definitely the correct choice.
Reviewed-by: Elias Huhsovitz <e.huhsovitz@proxmox.com>
Tested-by: Elias Huhsovitz <e.huhsovitz@proxmox.com>
On Tue Aug 11, 2026 at 9:37 AM CEST, Jakob Klocker wrote:
> `qemu_img_resize` already defaults to a timeout of 10 seconds when none
> is passed, so passing 10 explicitly is redundant.
>
> Signed-off-by: Jakob Klocker <j.klocker@proxmox.com>
> ---
> src/PVE/Storage/LVMPlugin.pm | 2 +-
> src/PVE/Storage/Plugin.pm | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm
> index b8646c2..768ff95 100644
> --- a/src/PVE/Storage/LVMPlugin.pm
> +++ b/src/PVE/Storage/LVMPlugin.pm
> @@ -1081,7 +1081,7 @@ sub volume_resize {
>
> if (!$running && $format eq 'qcow2') {
> my $preallocation = PVE::Storage::Plugin::preallocation_cmd_opt($scfg, $format);
> - PVE::Storage::Common::qemu_img_resize($path, $format, $size, $preallocation, 10);
> + PVE::Storage::Common::qemu_img_resize($path, $format, $size, $preallocation);
> }
>
> return 1;
> diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
> index 4f69f9b..082355d 100644
> --- a/src/PVE/Storage/Plugin.pm
> +++ b/src/PVE/Storage/Plugin.pm
> @@ -1373,7 +1373,7 @@ sub volume_resize {
> my $format = ($class->parse_volname($volname))[6];
>
> my $preallocation = preallocation_cmd_opt($scfg, $format);
> - PVE::Storage::Common::qemu_img_resize($path, $format, $size, $preallocation, 10);
> + PVE::Storage::Common::qemu_img_resize($path, $format, $size, $preallocation);
>
> return undef;
> }
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH pve-storage v3 2/2] fix #7598: qemu-img: increase timeout for image resizing in worker context
2026-08-11 7:37 [PATCH storage v3 0/2] fix #7598: qemu-img: increase timeout for image resize Jakob Klocker
2026-08-11 7:37 ` [PATCH pve-storage v3 1/2] qemu-img: drop redundant timeout argument at resize call Jakob Klocker
@ 2026-08-11 7:37 ` Jakob Klocker
2026-08-13 9:06 ` Elias Huhsovitz
2026-09-18 8:29 ` applied: [PATCH storage v3 0/2] fix #7598: qemu-img: increase timeout for image resize Fiona Ebner
2 siblings, 1 reply; 6+ messages in thread
From: Jakob Klocker @ 2026-08-11 7:37 UTC (permalink / raw)
To: pve-devel; +Cc: Jakob Klocker
Mirror ZFS behaviour and increase timeout to an hour when in a worker
context. This fixes issues some users [0] have with slow disks where a
resize would fail.
[0] https://bugzilla.proxmox.com/show_bug.cgi?id=7598
Signed-off-by: Jakob Klocker <j.klocker@proxmox.com>
---
src/PVE/Storage/Common.pm | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/PVE/Storage/Common.pm b/src/PVE/Storage/Common.pm
index 3932aee..1c3fdad 100644
--- a/src/PVE/Storage/Common.pm
+++ b/src/PVE/Storage/Common.pm
@@ -3,6 +3,7 @@ package PVE::Storage::Common;
use v5.36;
use PVE::JSONSchema;
+use PVE::RPCEnvironment;
use PVE::Syscall;
use PVE::Tools qw(run_command);
@@ -262,8 +263,8 @@ sub qemu_img_measure {
qemu_img_resize($path, $format, $size, $preallocation, $timeout)
Resize a qemu image C<$path> with format C<$format> to a target Kb size C<$size>.
-Default timeout C<$timeout> is 10s if not specified.
C<$preallocation> allows to specify the preallocation option for the resize operation.
+If no C<$timeout> is provided, it defaults to 10 seconds, or 1 hour when running in a worker context.
=cut
@@ -276,7 +277,8 @@ sub qemu_img_resize {
push $cmd->@*, "--preallocation=$preallocation" if $preallocation;
push $cmd->@*, '-f', $format, $path, $size;
- $timeout = 10 if !$timeout;
+ $timeout = PVE::RPCEnvironment->is_worker() ? 60 * 60 : 10
+ if !$timeout;
run_command($cmd, timeout => $timeout);
}
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH pve-storage v3 2/2] fix #7598: qemu-img: increase timeout for image resizing in worker context
2026-08-11 7:37 ` [PATCH pve-storage v3 2/2] fix #7598: qemu-img: increase timeout for image resizing in worker context Jakob Klocker
@ 2026-08-13 9:06 ` Elias Huhsovitz
0 siblings, 0 replies; 6+ messages in thread
From: Elias Huhsovitz @ 2026-08-13 9:06 UTC (permalink / raw)
To: Jakob Klocker, pve-devel
Tested again using
pvesh set /nodes/{node}/qemu/{vmid}/resize --disk scsi0 --size +{num}G
and the GUI option VM->Disk Action->Resize
Which correctly set the $timeout=3600 in the worker context as intended.
Reviewed-by: Elias Huhsovitz <e.huhsovitz@proxmox.com>
Tested-by: Elias Huhsovitz <e.huhsovitz@proxmox.com>
On Tue Aug 11, 2026 at 9:37 AM CEST, Jakob Klocker wrote:
> Mirror ZFS behaviour and increase timeout to an hour when in a worker
> context. This fixes issues some users [0] have with slow disks where a
> resize would fail.
>
> [0] https://bugzilla.proxmox.com/show_bug.cgi?id=7598
>
> Signed-off-by: Jakob Klocker <j.klocker@proxmox.com>
> ---
> src/PVE/Storage/Common.pm | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/PVE/Storage/Common.pm b/src/PVE/Storage/Common.pm
> index 3932aee..1c3fdad 100644
> --- a/src/PVE/Storage/Common.pm
> +++ b/src/PVE/Storage/Common.pm
> @@ -3,6 +3,7 @@ package PVE::Storage::Common;
> use v5.36;
>
> use PVE::JSONSchema;
> +use PVE::RPCEnvironment;
> use PVE::Syscall;
> use PVE::Tools qw(run_command);
>
> @@ -262,8 +263,8 @@ sub qemu_img_measure {
> qemu_img_resize($path, $format, $size, $preallocation, $timeout)
>
> Resize a qemu image C<$path> with format C<$format> to a target Kb size C<$size>.
> -Default timeout C<$timeout> is 10s if not specified.
> C<$preallocation> allows to specify the preallocation option for the resize operation.
> +If no C<$timeout> is provided, it defaults to 10 seconds, or 1 hour when running in a worker context.
>
> =cut
>
> @@ -276,7 +277,8 @@ sub qemu_img_resize {
> push $cmd->@*, "--preallocation=$preallocation" if $preallocation;
> push $cmd->@*, '-f', $format, $path, $size;
>
> - $timeout = 10 if !$timeout;
> + $timeout = PVE::RPCEnvironment->is_worker() ? 60 * 60 : 10
> + if !$timeout;
> run_command($cmd, timeout => $timeout);
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* applied: [PATCH storage v3 0/2] fix #7598: qemu-img: increase timeout for image resize
2026-08-11 7:37 [PATCH storage v3 0/2] fix #7598: qemu-img: increase timeout for image resize Jakob Klocker
2026-08-11 7:37 ` [PATCH pve-storage v3 1/2] qemu-img: drop redundant timeout argument at resize call Jakob Klocker
2026-08-11 7:37 ` [PATCH pve-storage v3 2/2] fix #7598: qemu-img: increase timeout for image resizing in worker context Jakob Klocker
@ 2026-09-18 8:29 ` Fiona Ebner
2 siblings, 0 replies; 6+ messages in thread
From: Fiona Ebner @ 2026-09-18 8:29 UTC (permalink / raw)
To: pve-devel, Jakob Klocker
On Tue, 11 Aug 2026 09:37:38 +0200, Jakob Klocker wrote:
> Image resizing currently has a timeout of 10 seconds, which can fail
> on slow disks and leave the VM in a state where the disk is updated,
> but the VM config isn't.
>
> Since there is no deterministic way to check, with less overhead, if
> this is the case, increasing the timeout is the most pragmatic
> solution. The resize is only called in a worker context anyway,
> therefore this patch series mirrors the ZFS timeout: it increases
> the timeout in a worker context to 1 hour; as a fallback for a
> non-worker context the timeout stays 10 seconds.
>
> [...]
Applied, thanks! In the second patch, I made two small changes:
* style: avoid combining ternary conditional operator and post-if
* wrap doc comment to avoid line longer than 100 characters
[1/2] qemu-img: drop redundant timeout argument at resize call
commit: 1b930a64a67ba21b7e3f4d3cfb578f240c71b661
[2/2] fix #7598: qemu-img: increase timeout for image resizing in worker context
commit: e27a8036f5dc9d2d09e427b055264d97725566d7
^ permalink raw reply [flat|nested] 6+ messages in thread