public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 2/2] fix #2315: api: have resize endpoint spawn a worker task
Date: Tue, 30 May 2023 15:52:04 +0200	[thread overview]
Message-ID: <20230530135207.87705-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20230530135207.87705-1-f.ebner@proxmox.com>

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>
---

I just went with calling the task 'resize' too like for containers.
Should I rather use a different name, to be able to distinguish them?

 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 a80eefc9..84fc1fdb 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -4680,7 +4680,10 @@ __PACKAGE__->register_method({
 	    },
 	},
     },
-    returns => { type => 'null'},
+    returns => {
+	type => 'string',
+	description => "the task ID.",
+    },
     code => sub {
         my ($param) = @_;
 
@@ -4764,8 +4767,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({
-- 
2.39.2





  parent reply	other threads:[~2023-05-30 13:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30 13:52 [pve-devel] [PATCH-SERIES qemu-server/manager/container] resize endpoint improvements Fiona Ebner
2023-05-30 13:52 ` [pve-devel] [PATCH qemu-server 1/2] fix #517: api: allow resizing qcow2 disk with snapshots Fiona Ebner
2023-05-30 13:52 ` Fiona Ebner [this message]
2023-05-30 13:52 ` [pve-devel] [PATCH manager 1/1] ui: override description for resize task Fiona Ebner
2023-05-30 13:52 ` [pve-devel] [PATCH container 1/2] api: resize: drop error that can never apply Fiona Ebner
2023-05-30 13:52 ` [pve-devel] [PATCH container 2/2] api: resize: fork before locking Fiona Ebner
2023-06-07 17:29 ` [pve-devel] applied-series: [PATCH-SERIES qemu-server/manager/container] resize endpoint improvements Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230530135207.87705-3-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal