]> git.proxmox.com Git - qemu-server.git/commitdiff
fix #2315: api: have resize endpoint spawn a worker task
authorFiona Ebner <f.ebner@proxmox.com>
Tue, 30 May 2023 13:52:04 +0000 (15:52 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 7 Jun 2023 17:23:52 +0000 (19:23 +0200)
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 <f.ebner@proxmox.com>
PVE/API2/Qemu.pm

index e2285afab1ee3cec18c6de221b17af6d2a7f38b6..8b4d26e838c26a154a7006740491b15a6ba7075f 100644 (file)
@@ -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({