From 606d9d76b25c533f15d589d4927015c8e3d78a1b Mon Sep 17 00:00:00 2001 From: Fiona Ebner Date: Tue, 30 May 2023 15:52:04 +0200 Subject: [PATCH] fix #2315: api: have resize endpoint spawn a worker task Similar to the corresponding endpoint for containers. Because disks are involved, this can be a longer running operation, as is also indicated by the 60 seconds timeout used in qemu_block_resize() which is called by this endpoint. This is a breaking API change. Signed-off-by: Fiona Ebner --- PVE/API2/Qemu.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index e2285afa..8b4d26e8 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -4700,7 +4700,10 @@ __PACKAGE__->register_method({ }, }, }, - returns => { type => 'null'}, + returns => { + type => 'string', + description => "the task ID.", + }, code => sub { my ($param) = @_; @@ -4784,8 +4787,11 @@ __PACKAGE__->register_method({ PVE::QemuConfig->write_config($vmid, $conf); }; - PVE::QemuConfig->lock_config($vmid, $updatefn); - return; + my $worker = sub { + PVE::QemuConfig->lock_config($vmid, $updatefn); + }; + + return $rpcenv->fork_worker('resize', $vmid, $authuser, $worker); }}); __PACKAGE__->register_method({