rename symbols
Alexander Zubkov
green at qrator.net
Tue Jan 24 08:20:07 CET 2023
On Tue, Jan 24, 2023 at 7:05 AM Maria Matejka via Bird-users <
bird-users at network.cz> wrote:
> Hello!
>
> > For example I may want to refactor the naming scheme for
> > protocols/tables in my bird config. But when I apply the new config with
> > the new names, such renamed protocols will be recreated or restarted,
> > which may be undesired. So if I could rename protocols/tables in advance
> > and then load the new config, I can hope than no changes would be found
> > and the there would be no interruptions.
>
> What I was thinking about some time ago, was not this kind of "renaming
> from CLI" but a special clause "renamed XYZ to ABC" which could be put
> at the end (!) of the new config. This would solve the problem with
> rewriting the symbol in-place which is ugly.
>
Yes, that is ugly and I would not run the "renamed" configuration long,
just for the transition. But it is the minimal intervention I figured out.
I was thinking about adding new symbols instead of changing the name
in-place, but there are too many places where you need to update the
pointers to the new names. And still you need to do something with the old
symbol. When I rename them in place, it updates the names automatically, as
they all point to the buffer inside symbol, as far as I understand.
>
> Yet there are problems (mostly in v3) where e.g. the protocol name is
> pre-formatted into other strings, effectively forcing us to walk through
> the code and find all these cases while renaming. We don't want BIRD to
> errorneously log about a protocol with its old name.
>
Could you explain it more, when will you need to change something more in
the code in my or your variant (with renamed statement)? As I udnerstand,
in my variant, it should not be possible to log the old name, because I
replace the string in-place. Only if it was copied somewhere. Anyway after
loading the new config it should go away. In your variant too, if you do
the second step and load the final config without "renamed" than there also
should not be the old names. I don't think we should care much about
logging during the transition.
>
> All in all, I'd not opposed to this idea, yet from my current POV, the
> changes needed are too high for now to have it a single patch or so.
>
> Thank you for your suggestion!
>
> Maria
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20230124/4ed4f2fb/attachment.htm>
More information about the Bird-users
mailing list