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 <f.ebner@proxmox.com>
This commit is contained in:
Fiona Ebner 2023-05-30 15:52:04 +02:00 committed by Thomas Lamprecht
parent a6f14ef49b
commit 606d9d76b2

View 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({