From: Gabriel Goller <g.goller@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] fix: proxmox-backup-manager network reload wait on worker
Date: Wed, 21 Aug 2024 12:22:36 +0200 [thread overview]
Message-ID: <20240821102236.220755-1-g.goller@proxmox.com> (raw)
Make the `network reload` command in proxmox-backup-manager wait on the
api handler's workertask. Otherwise the task would be killed when the
client exits.
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
src/bin/proxmox_backup_manager/network.rs | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/bin/proxmox_backup_manager/network.rs b/src/bin/proxmox_backup_manager/network.rs
index deac5b1b2960..0f0a50a8932a 100644
--- a/src/bin/proxmox_backup_manager/network.rs
+++ b/src/bin/proxmox_backup_manager/network.rs
@@ -129,6 +129,24 @@ fn pending_network_changes(
Ok(Value::Null)
}
+#[api()]
+/// Reload network changes
+async fn reload_network_changes(
+ mut param: Value,
+ rpcenv: &mut dyn RpcEnvironment,
+) -> Result<Value, Error> {
+ param["node"] = "localhost".into();
+
+ let info = &api2::node::network::API_METHOD_RELOAD_NETWORK_CONFIG;
+ let result = match info.handler {
+ ApiHandler::Async(handler) => (handler)(param, info, rpcenv).await?,
+ _ => unreachable!(),
+ };
+ crate::wait_for_local_worker(result.as_str().unwrap()).await?;
+
+ Ok(Value::Null)
+}
+
pub fn network_commands() -> CommandLineInterface {
let cmd_def = CliCommandMap::new()
.insert("list", CliCommand::new(&API_METHOD_LIST_NETWORK_DEVICES))
@@ -168,8 +186,7 @@ pub fn network_commands() -> CommandLineInterface {
)
.insert(
"reload",
- CliCommand::new(&api2::node::network::API_METHOD_RELOAD_NETWORK_CONFIG)
- .fixed_param("node", String::from("localhost")),
+ CliCommand::new(&API_METHOD_RELOAD_NETWORK_CHANGES),
);
cmd_def.into()
--
2.39.2
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next reply other threads:[~2024-08-21 10:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-21 10:22 Gabriel Goller [this message]
2024-08-29 12:17 ` [pbs-devel] applied: " Wolfgang Bumiller
2024-08-30 8:18 ` Gabriel Goller
2024-08-30 9:00 ` Wolfgang Bumiller
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=20240821102236.220755-1-g.goller@proxmox.com \
--to=g.goller@proxmox.com \
--cc=pbs-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.