diff options
author | Christian Breunig <christian@breunig.cc> | 2025-01-06 18:05:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-06 19:05:06 +0200 |
commit | f9f4137d09564da90a18fec9c9d7ceb64cb6c736 (patch) | |
tree | 00997fcbf111c86de8303f69d8e11ddb00ff8722 /src/services | |
parent | 53cb3e5cb9b0c88a5c83753bfadb5087b4aeb2b1 (diff) | |
download | vyos-1x-f9f4137d09564da90a18fec9c9d7ceb64cb6c736.tar.gz vyos-1x-f9f4137d09564da90a18fec9c9d7ceb64cb6c736.zip |
configd: T6747: use one long-lived instance of FRRender (#4274)
* smoketest: T6747: call wait after commit() only for FRR related tests
Commit 702a60a8de28 ("smoketest: T6746: wait after commit() until frr-reload
is no longer running") added a guard timeout for every commit executed via CLI
smoketests. This commit changes the bahavior to only add the guard timeout
for FRR related testscases.
This improves the overall smoketest time.
* configd: T6747: use one long-lived instance of FRRender
Previously there was one FRRender() instance per config session. This resulted
in re-rendering the FRR configuration every time a new config session was
created.
Example:
vyos@vyos:~$ configure
vyos@vyos# set interfaces dummy dum0 description foo
vyos@vyos# commit
vyos@vyos# exit
vyos@vyos:~$ configure
vyos@vyos# set interfaces dummy dum0 description bar
vyos@vyos# commit
vyos@vyos# exit
In the past this caused a re-render of the FRR configuration as the delta check
added in commit ec80c75d6776 ("frrender: T6746: only re-render FRR config if
config_dict did change") evaluated to false, as it operated on a new instance
of the FRRender class.
With this change there is no FRR re-render, as there is nothing to update
in FRR.
Diffstat (limited to 'src/services')
-rwxr-xr-x | src/services/vyos-configd | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/services/vyos-configd b/src/services/vyos-configd index e4655fdf7..b161fe6ba 100755 --- a/src/services/vyos-configd +++ b/src/services/vyos-configd @@ -211,9 +211,6 @@ def initialization(socket): scripts_called = [] setattr(config, 'scripts_called', scripts_called) - if not hasattr(config, 'frrender_cls'): - setattr(config, 'frrender_cls', FRRender()) - return config @@ -312,8 +309,10 @@ if __name__ == '__main__': remove_if_file(configd_env_file) os.symlink(configd_env_set_file, configd_env_file) - config = None + # We only need one long-lived instance of FRRender + frr = FRRender() + config = None while True: # Wait for next request from client msg = socket.recv().decode() @@ -332,10 +331,11 @@ if __name__ == '__main__': scripts_called = getattr(config, 'scripts_called', []) logger.debug(f'scripts_called: {scripts_called}') - if hasattr(config, 'frrender_cls') and res == R_SUCCESS: - frrender_cls = getattr(config, 'frrender_cls') + if res == R_SUCCESS: tmp = get_frrender_dict(config) - if frrender_cls.generate(tmp): - frrender_cls.apply() + if frr.generate(tmp): + # only apply a new FRR configuration if anything changed + # in comparison to the previous applied configuration + frr.apply() else: logger.critical(f'Unexpected message: {message}') |