Page MenuHomeVyOS Platform

Make node path completion read directly from the active config directory tree
Open, LowPublic

Description

Right now, the path completion for op mode translates to /bin/cli-shell-api listActiveNodes <path> | sed -e "s/'//g" && echo.

That's rarely a major performance problem, but:

  1. As long as we use CStore and its "directory tree as a config tree" approach, getting active nodes for op mode completion is nothing more than listing a directory under /opt/vyatta/config/active.
  2. cli-shell-api and CStore in general do a lot of things just to start up, and it's about four times slower than ls.
  3. The complete commands that needs to unquote node names takes three subprocess spawns instead of one.

We could use a simple directory listing instead of that call. Since the command is generated from XML definitions using a template, it's trivial to replace and will equally trivial to replace again when we implement a proper config daemon with in-memory config trees.

vyos@vyos# time /bin/cli-shell-api listActiveNodes service
'ntp' 'ssh'
real	0m0.007s
user	0m0.004s
sys	0m0.003s
[edit]
vyos@vyos# time ls /opt/vyatta/config/active/service/
ntp  ssh

real	0m0.002s
user	0m0.000s
sys	0m0.002s

Details

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Performance optimization