From: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
To: Stefan Hanreich <s.hanreich@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [RFC pve-network 1/1] sdn: apply changes on all nodes in parallel
Date: Thu, 12 Nov 2026 13:42:18 +0100 [thread overview]
Message-ID: <xfqhb2qpxg5mrb5f2mv2455wnz5j2wxab3sobrs5lshtxm4zd6@kkeef4h4a6cj> (raw)
In-Reply-To: <17ce3fca-ab64-426a-b72c-2cb6b12ea4fe@proxmox.com>
On Fri, Sep 18, 2026 at 01:21:13PM +0200, Stefan Hanreich wrote:
>
>
> On 9/18/26 11:50 AM, Gabriel Goller wrote:
> >> +
[...]
> >> __PACKAGE__->register_method({
> >> name => 'reload',
> >> protected => 1,
> >> @@ -291,6 +303,7 @@ __PACKAGE__->register_method({
> >> permissions => {
> >> check => ['perm', '/sdn', ['SDN.Allocate']],
> >
> > Hmm this endpoint has SDN.Allocate and the PUT /network endpoint we are calling
> > (in pve-manager) needs Sys.Modify. This shouldn't be an issue, but maybe we
> > should require Sys.Modify here as well to short-circuit everything, instead of
> > making a request to every node.
>
> Hmm, pre-existing, but what about setups where a user has Sys.Modify only on some nodes? That's
> currently possible but probably quite bad, since it allows applying the SDN configuration to
> some nodes only. So, I agree - but a breaking change?
>
afaict the breaking change is already in no? a user with such mixed
permissions or only SDN.Alloacte was able to reload all nodes before
since it was running with pvesh as root, this commit changes that
right? sorry for the noise in case i'm misunderstanding something.
> >> },
> >> + expose_credentials => 1,
> >> parameters => {
> >> additionalProperties => 0,
> >> properties => {
> >> @@ -336,22 +349,56 @@ __PACKAGE__->register_method({
> >> my $regenerate_frr = ($previous_config_has_frr || $new_config_has_frr) ? 1 : 0;
> >>
> >> my $code = sub {
> >> - $rpcenv->{type} = 'priv'; # to start tasks in background
> >> PVE::Cluster::check_cfs_quorum();
> >> +
> >> + my $api_client = create_api_client();
> >> my $nodelist = PVE::Cluster::get_nodelist();
> >> +
> >> + my $tasks = {};
> >> +
> >> for my $node (@$nodelist) {
> >> - my $pid = eval { $create_reload_network_worker->($node, $regenerate_frr) };
> >> - warn $@ if $@;
> >> + print "$node: reloading network config\n";
> >> +
> >> + my $upid = eval {
> >> + $api_client->put(
> >> + "/nodes/$node/network",
> >> + {
> >> + 'regenerate-frr' => $regenerate_frr,
> >> + },
> >> + );
> >> + };
> >> +
> >> + if ($@) {
> >> + log_warn("$node: could not reload network configuration: $@\n");
> >> + next;
> >> + }
> >> +
> >> + $tasks->{$upid} = $node;
> >> }
> >>
> >> - # FIXME: use libpve-apiclient (like in cluster join) to create
> >> - # tasks and moitor the tasks.
> >> + print "waiting for reload tasks to finish\n";
> >>
> >> - return;
> >> + while ($tasks->%*) {
> >> + for my $upid (keys $tasks->%*) {
> >> + my $node = $tasks->{$upid};
> >> + my $task = eval { $api_client->get("/nodes/$node/tasks/$upid/status") };
> >> +
> >> + if ($@) {
> >> + log_warn("could not get status of reload task: $@\n");
> >> + delete $tasks->{$upid};
> >> + next;
> >> + }
> >
> > Hmm should we wait more than 1 second here maybe? What if the reload brings the
> > network down shortly... Maybe add a counter and require a task to be gone for
> > 3-4 seconds?
>
> yes, potentially even a re-try logic before giving up completely...
>
> >> +
> >> + next if $task->{status} eq 'running';
> >
> > Should we add a exitstatus check here and print a warning like "reload failed"
> > or something?
> >
> >> + print "$node: reload task finished\n";
> >> + delete $tasks->{$upid};
> >> + }
> >> +
> >> + sleep(1);
> >
> > Do the pve tasks have a maximum duration where they get killed if they take
> > longer? Otherwise a stuck task will make this loop forever.
> >
> > Although this is a task as well isn't it -- it can just be force-stopped in
> > the ui.
>
> Should be fine imo, due to the possibility of cancelling the task itself.
>
> >> + }
> >> };
> >>
> >> return $rpcenv->fork_worker('reloadnetworkall', undef, $authuser, $code);
> >> -
> >> },
> >> });
> >>
> >> --
> >> 2.47.3
>
>
>
>
>
>
next prev parent reply other threads:[~2026-11-12 12:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 14:06 [RFC pve-network 1/1] sdn: apply changes on all nodes in parallel Stefan Hanreich
2026-07-13 8:58 ` Daniel Herzig
2026-09-18 9:50 ` Gabriel Goller
2026-09-18 11:21 ` Stefan Hanreich
2026-09-18 11:28 ` Gabriel Goller
2026-11-12 12:42 ` Arthur Bied-Charreton [this message]
2026-09-21 10:56 ` DERUMIER, Alexandre
2026-09-22 8:47 ` SPAM: " Stefan Hanreich
2026-09-22 8:53 ` DERUMIER, Alexandre
2026-09-22 8:55 ` Stefan Hanreich
2026-11-12 12:37 ` Arthur Bied-Charreton
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=xfqhb2qpxg5mrb5f2mv2455wnz5j2wxab3sobrs5lshtxm4zd6@kkeef4h4a6cj \
--to=a.bied-charreton@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
--cc=s.hanreich@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