From: Stefan Hanreich <s.hanreich@proxmox.com>
To: Dominik Csapak <d.csapak@proxmox.com>,
Proxmox Datacenter Manager development discussion
<pdm-devel@lists.proxmox.com>
Subject: Re: [pdm-devel] [PATCH proxmox-datacenter-manager 01/16] server: add locked sdn client helpers
Date: Wed, 27 Aug 2025 15:22:13 +0200 [thread overview]
Message-ID: <0035abf7-5817-4965-958f-0f3868b0c971@proxmox.com> (raw)
In-Reply-To: <41275156-4c79-43e3-a784-f81c4a7b801e@proxmox.com>
On 8/27/25 3:10 PM, Dominik Csapak wrote:
> [snip]
>>>> +
>>>> + if errors {
>>>> + let mut rollback_futures = FuturesUnordered::new();
>>>> +
>>>> + for (client, ctx) in self.clients {
>>>> + let ctx = Arc::new(ctx);
>>>> + let err_ctx = ctx.clone();
>>>> +
>>>> + rollback_futures.push(
>>>> + client
>>>> + .rollback_and_release()
>>>> + .map_ok(|_| ctx)
>>>> + .map_err(|err| (err, err_ctx)),
>>>> + );
>>>> + }
>>>> +
>>>> + while let Some(result) = rollback_futures.next().await {
>>>> + match result {
>>>> + Ok(ctx) => {
>>>> + proxmox_log::info!(
>>>> + "successfully rolled back configuration
>>>> for remote {}",
>>>> + ctx.remote_id()
>>>> + )
>>>> + }
>>>> + Err((_, ctx)) => {
>>>> + proxmox_log::error!(
>>>> + "could not rollback configuration for
>>>> remote {}",
>>>> + ctx.remote_id()
>>>> + )
>>>> + }
>>>> + }
>>>> + }
>>>
>>>
>>> if we could not rollback_and_release, should we maybe call release for
>>> those ? The admin has to cleanup anyway, but is it possible for one to
>>> release such a lock (via the gui?). Not very sure about the lock
>>> semantics here.
>>
>> I thought about it, but I think it is better to leave the remote locked
>> on failure since admins then get an error on the respective PVE remote
>> if they want to change some settings there.
>>
>> They can then either explicitly rollback the changes manually or fix the
>> issues and apply the configuration anyway.
>>
>> The most likely scenario for why this would fail is networking issues
>> imo. I think if the rollback_and_release call fails, there is a decent
>> chance that a subsequent release call will fail as well. This would
>> introduce a third level of requests + error handling, which I'm not sure
>> is worth the potential gain.
>>
>> It is also analogous to e.g. failures when snapshotting a VM where the
>> lock needs to be forcibly released iirc.
>>
>> I think the error message could be improved by indicating that the
>> configuration is left untouched and admins need to rollback / release
>> manually and potentially even a indicator / pointer on how to do it.
>>
>>
>>> also using FuturesUnordered here can make sense here, but it's not
>>> really parallel, since it only does work during await.
>>>
>>> does it make a big difference (for many remotes) instead of just
>>> awaiting the futures directly? or joining them ?
>>>
>>> i.e. having a large number of remotes unordered in the logs does not
>>> make it easier to read.
>>>
>>> I'd either expect the remotes to be sorted, or the failed remotes to be
>>> separated from the successful ones (e.g. only logging the error ones
>>> separately and only a number for the succesful ones?)
>>
>> I think I had some issues with just using a Vec of futures + join_all
>> (ownership + borrowing with clients / ctx) and using FuturesUnordered
>> resolved the issue. I'll check again more thoroughly on the root cause
>> and report back. I wanted to improve how the requests are made in the
>> client anyway, but didn't yet get around to it. We might also just want
>> to spawn blocking tasks in tokio instead.
>>
>> Using FuturesOrdered would be fine if collecting into a Vec doesn't
>> work, but then we should maybe sort the clients in the constructor
>> (alphabetically by remote name?) to ensure deterministic/consistent
>> ordering any time any function in this collection is called.
>>
>> Anyway, I'll look into improving this in the next version (most likely
>> by spawning blocking tasks in tokio itself)!
>>
>>
> i don't think the tasks have to be blocking (since the code is async
> anyway?)
yeah, you're right.
> but you could do something similar to lukas with e.g.
> joinset + a semaphore to make (limited) parallel requests
>
> if we have a clearer picture of the things we want/need
> from such a thing in the future, we could abstract that
I'll talk to Lukas and check out his implementation. We talked shortly
about it last week, but I only took a cursory glance of his implementation.
We might be able to convert this to wrap Lukas' implementation at some
point in the future. Potentially we could do this in a follow-up as well
to avoid doing the same work twice / duplicate the logic, since imo for
starting out the current implementation is good enough - what do you think?
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next prev parent reply other threads:[~2025-08-27 13:22 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-27 11:33 [pdm-devel] [PATCH network/proxmox{, -backup, -api-types, -datacenter-manager} 00/32] Add initial SDN / EVPN integration Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox 1/2] schema: use i64 for minimum / maximum / default integer values Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox 2/2] pbs-api-types: fix values for integer schemas Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox-backup 1/1] api: change integer schema parameters to i64 Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH pve-network 1/6] sdn: api: return null for rollback / lock endpoints Stefan Hanreich
2025-08-28 7:56 ` Dominik Csapak
2025-08-28 9:22 ` Stefan Hanreich
2025-08-28 19:46 ` Thomas Lamprecht
2025-08-27 11:33 ` [pdm-devel] [PATCH pve-network 2/6] controllers: fix maximum value for ASN Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH pve-network 3/6] api: add state standard option Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH pve-network 4/6] api: controllers: update schema of endpoints Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH pve-network 5/6] api: vnets: " Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH pve-network 6/6] api: zones: " Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox-api-types 1/7] add QemuMigratePreconditionsNotAllowedNodesBlockingHaResources struct Stefan Hanreich
2025-08-27 11:58 ` Dominik Csapak
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox-api-types 2/7] sdn: add list/create zone endpoints Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox-api-types 3/7] sdn: add list/create vnet endpoints Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox-api-types 4/7] sdn: add list/create controller endpoints Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox-api-types 5/7] sdn: add sdn configuration locking endpoints Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox-api-types 6/7] tasks: add helper for querying successfully finished tasks Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox-api-types 7/7] sdn: add helpers for pending values Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox-datacenter-manager 01/16] server: add locked sdn client helpers Stefan Hanreich
2025-08-27 12:27 ` Dominik Csapak
2025-08-27 13:04 ` Stefan Hanreich
2025-08-27 13:10 ` Dominik Csapak
2025-08-27 13:22 ` Stefan Hanreich [this message]
2025-08-27 13:29 ` Dominik Csapak
2025-08-27 13:34 ` Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox-datacenter-manager 02/16] ui: tasks: add descriptions for SDN tasks Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox-datacenter-manager 03/16] api: sdn: add list_zones endpoint Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox-datacenter-manager 04/16] api: sdn: add create_zone endpoint Stefan Hanreich
2025-08-27 13:44 ` Dominik Csapak
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox-datacenter-manager 05/16] api: sdn: add list_vnets endpoint Stefan Hanreich
2025-08-27 13:45 ` Dominik Csapak
2025-08-28 9:01 ` Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox-datacenter-manager 06/16] api: sdn: add create_vnet endpoint Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox-datacenter-manager 07/16] api: sdn: add list_controllers endpoint Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox-datacenter-manager 08/16] ui: sdn: add EvpnRouteTarget type Stefan Hanreich
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox-datacenter-manager 09/16] ui: sdn: add vnet icon Stefan Hanreich
2025-08-27 14:06 ` Dominik Csapak
2025-08-28 9:04 ` Stefan Hanreich
2025-08-28 9:10 ` Dominik Csapak
2025-08-27 11:33 ` [pdm-devel] [PATCH proxmox-datacenter-manager 10/16] ui: sdn: add remote tree component Stefan Hanreich
2025-08-27 14:48 ` Dominik Csapak
2025-08-27 11:34 ` [pdm-devel] [PATCH proxmox-datacenter-manager 11/16] ui: add view for showing ip vrfs Stefan Hanreich
2025-08-28 7:15 ` Dominik Csapak
2025-08-27 11:34 ` [pdm-devel] [PATCH proxmox-datacenter-manager 12/16] ui: sdn: add AddVnetWindow component Stefan Hanreich
2025-08-28 7:49 ` Dominik Csapak
2025-08-27 11:34 ` [pdm-devel] [PATCH proxmox-datacenter-manager 13/16] ui: sdn: add AddZoneWindow component Stefan Hanreich
2025-08-28 7:50 ` Dominik Csapak
2025-08-27 11:34 ` [pdm-devel] [PATCH proxmox-datacenter-manager 14/16] ui: sdn: add EvpnPanel Stefan Hanreich
2025-08-28 7:54 ` Dominik Csapak
2025-08-27 11:34 ` [pdm-devel] [PATCH proxmox-datacenter-manager 15/16] ui: sdn: add EvpnPanel to main menu Stefan Hanreich
2025-08-27 14:07 ` Dominik Csapak
2025-08-27 11:34 ` [pdm-devel] [PATCH proxmox-datacenter-manager 16/16] pve: sdn: add descriptions for sdn tasks Stefan Hanreich
2025-08-28 8:06 ` [pdm-devel] [PATCH network/proxmox{, -backup, -api-types, -datacenter-manager} 00/32] Add initial SDN / EVPN integration Dominik Csapak
2025-08-29 14:54 ` [pdm-devel] superseded: " Stefan Hanreich
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=0035abf7-5817-4965-958f-0f3868b0c971@proxmox.com \
--to=s.hanreich@proxmox.com \
--cc=d.csapak@proxmox.com \
--cc=pdm-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