* [PATCH pve-storage v2 1/2] qemu-img: drop unused image resize timeout parameter
2026-08-04 9:04 [PATCH storage v2 0/2] fix #7598: qemu-img: increase timeout for image resize Jakob Klocker
@ 2026-08-04 9:04 ` Jakob Klocker
2026-08-04 9:04 ` [PATCH pve-storage v2 2/2] fix #7598: qemu-img: increase timeout for image resizing in worker context Jakob Klocker
1 sibling, 0 replies; 3+ messages in thread
From: Jakob Klocker @ 2026-08-04 9:04 UTC (permalink / raw)
To: pve-devel; +Cc: Jakob Klocker
qemu_img_resize is only ever called with a hardcoded 10 second timeout,
so exposing it as a parameter serves no purpose.
Signed-off-by: Jakob Klocker <j.klocker@proxmox.com>
---
src/PVE/Storage/Common.pm | 8 ++++----
src/PVE/Storage/LVMPlugin.pm | 2 +-
src/PVE/Storage/Plugin.pm | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/PVE/Storage/Common.pm b/src/PVE/Storage/Common.pm
index 3932aee..725f623 100644
--- a/src/PVE/Storage/Common.pm
+++ b/src/PVE/Storage/Common.pm
@@ -259,16 +259,16 @@ sub qemu_img_measure {
=head3 qemu_img_resize
- qemu_img_resize($path, $format, $size, $preallocation, $timeout)
+ qemu_img_resize($path, $format, $size, $preallocation)
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.
+The operation uses a default timeout of 10s.
=cut
sub qemu_img_resize {
- my ($path, $format, $size, $preallocation, $timeout) = @_;
+ my ($path, $format, $size, $preallocation) = @_;
die "format is missing" if !$format;
@@ -276,7 +276,7 @@ sub qemu_img_resize {
push $cmd->@*, "--preallocation=$preallocation" if $preallocation;
push $cmd->@*, '-f', $format, $path, $size;
- $timeout = 10 if !$timeout;
+ my $timeout = 10;
run_command($cmd, timeout => $timeout);
}
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] 3+ messages in thread* [PATCH pve-storage v2 2/2] fix #7598: qemu-img: increase timeout for image resizing in worker context
2026-08-04 9:04 [PATCH storage v2 0/2] fix #7598: qemu-img: increase timeout for image resize Jakob Klocker
2026-08-04 9:04 ` [PATCH pve-storage v2 1/2] qemu-img: drop unused image resize timeout parameter Jakob Klocker
@ 2026-08-04 9:04 ` Jakob Klocker
1 sibling, 0 replies; 3+ messages in thread
From: Jakob Klocker @ 2026-08-04 9:04 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 | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/PVE/Storage/Common.pm b/src/PVE/Storage/Common.pm
index 725f623..ee95653 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);
@@ -263,7 +264,7 @@ sub qemu_img_measure {
Resize a qemu image C<$path> with format C<$format> to a target Kb size C<$size>.
C<$preallocation> allows to specify the preallocation option for the resize operation.
-The operation uses a default timeout of 10s.
+The operation uses a default timeout of 10s, or 1 hour when running in a worker context.
=cut
@@ -276,7 +277,7 @@ sub qemu_img_resize {
push $cmd->@*, "--preallocation=$preallocation" if $preallocation;
push $cmd->@*, '-f', $format, $path, $size;
- my $timeout = 10;
+ my $timeout = PVE::RPCEnvironment->is_worker() ? 60 * 60 : 10;
run_command($cmd, timeout => $timeout);
}
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread