Am 25.04.25 um 15:25 schrieb Daniel Kral: > On 4/25/25 14:25, Fiona Ebner wrote: >> Am 25.04.25 um 10:36 schrieb Daniel Kral: >>> On 4/24/25 12:12, Fiona Ebner wrote: >>> As suggested by @Lukas off-list, I'll also try to make the check >>> selective, e.g. the user has made an infeasible change to the config >>> manually by writing to the file and then wants to create another rule. >>> Here it should ignore the infeasible rules (as they'll be dropped >>> anyway) and only check if the added rule / changed rule is infeasible. >> >> How will you select the rule to drop? Applying the rules one-by-one to >> find a first violation? > > AFAICS we could use the same helpers to check whether the rules are > feasible, and only check whether the added / updated ruleid is one that > is causing these troubles. I guess this would be a reasonable option > without duplicating code, but still check against the whole config. > There's surely some optimization potential here, but then we would have > a larger problem at reloading the rule configuration for the manager > anyway. For the latter I could check for what size of a larger > configuration this could become an actual bottleneck. > > For either adding a rule or updating a rule, we would just make the > change to the configuration in-memory and run the helper. Depending on > the result, we'd store the config or error out to the API user.
ACK, I also don't think we need to worry too much about optimization here yet. >>> But as you said, it must not change the user's configuration in the end >>> as that would be very confusing to the user. >> >> Okay, so dropping dynamically. I guess we could also disable such rules >> explicitly/mark them as being in violation with other rules somehow: >> Tri-state enabled/disabled/conflict status? Explicit field? >> >> Something like that would make such rules easily visible and have the >> configuration better reflect the actual status. >> >> As discussed off-list now: we can try to re-enable conflicting rules >> next time the rules are loaded. > > Hm, there's three options now: > > - Allowing conflicts over the create / update API and auto-resolving the > conflicts as soon as we're able to (e.g. on the load / save where the > rule becomes feasible again). > > - Not allowing conflicts over the create / update API, but set the state > to 'conflict' if manual changes (or other circumstances) made the rules > be in conflict with one another. > > - Having something like the SDN config, where there's a working > configuration and a "draft" configuration that needs to be applied. So > conflicts are allowed in drafts, but not in working configurations. > > The SDN option seems too much for me here, but I just noticed some > similarity. > > I guess one of the first two makes more sense. If there's no arguments > against this, I'd choose the second option as we can always allow > intentional conflicts later if there's user demand or we see other > reasons in that. I do prefer the second option :) _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel