-
-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nut driver enumerator optimize #682
Merged
jimklimov
merged 61 commits into
networkupstools:master
from
jimklimov:nut-enum-optimize
Jan 20, 2024
Merged
Nut driver enumerator optimize #682
jimklimov
merged 61 commits into
networkupstools:master
from
jimklimov:nut-enum-optimize
Jan 20, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…led to add a normally-named one because it already exists (clean it up and then add)
…about yet-missing property
…sh the non-instance service (for global config)
…about yet-missing property
… setter into smf_setSavedUniq() for other use-cases
…avoid variable pollution in caller
…" for better readability
…up --get-device-for-service processing where possible
…up --get-device-for-service processing where possible (typo fix)
…r faster --get-service-for-device processing
…F FMRIs more intensively
…ceName data to be consistent (ensuring it is is expensive and belongs elsewhere)
…and upslist_savednames_find_mismatch() to upgrade entries without saved names
…e) and get_device_for_service() into routines
…ssing() into single-run and daemonized modes, to update inconsistent configs
…onfigure() into a routine
…le for daemonized mode
…ntionally not installed as PartOf/WantedBy anything, no auto-start
… of times we try to reload/restart nut-driver-enumerator-daemon.service
…(from non-daemonized origins) and we do forking
…ived oneshot service after all
…e.in : support a daemon-after mode
Signed-off-by: Jim Klimov <[email protected]>
…e in other systemd units Signed-off-by: Jim Klimov <[email protected]>
❌ Build nut 2.8.1.1170-master failed (commit b25dc8a1e6 by @jimklimov) |
…edDeviceName() to use common SYSTEMD_CONFPATH variable Signed-off-by: Jim Klimov <[email protected]>
Signed-off-by: Jim Klimov <[email protected]>
…stools#682] Signed-off-by: Jim Klimov <[email protected]>
…content(): optimize string emptiness checks Signed-off-by: Jim Klimov <[email protected]>
Signed-off-by: Jim Klimov <[email protected]>
34 tasks
jimklimov
added a commit
to jimklimov/nut
that referenced
this pull request
Apr 19, 2024
…d parentheses to curly braces, so we still recognize NEW_CHECKSUM for nut-driver reloads [networkupstools#2410, fallout of networkupstools#682] Signed-off-by: Jim Klimov <[email protected]>
jimklimov
added a commit
to jimklimov/nut
that referenced
this pull request
Apr 19, 2024
…ednames_find_missing() and upslist_savednames_find_mismatch() [networkupstools#682, networkupstools#2410] * Document better * Fix envvars used in queries * Fix matching of TABCHAR Signed-off-by: Jim Klimov <[email protected]>
jimklimov
added a commit
to jimklimov/nut
that referenced
this pull request
Apr 19, 2024
…t_savednames_find_mismatch() is reserved for future features and is incomplete [networkupstools#682, networkupstools#2410] Signed-off-by: Jim Klimov <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
nut-driver-enumerator (NDE)
nut-driver-enumerator (NDE) automates service management integration for NUT driver instances etc.
service/daemon start/stop
General subject for starting and stopping NUT daemons (drivers, server, monitor); also BG/FG/Debug
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Initial testing showed that, not too surprisingly, the honest full config parsing to get the device name for service instance is an overkill, especially on systems that monitor many power devices and parse such data all at once during startup. This particular issue can be addressed by caching the original device name into service properties, which can be inspected quickly - and only fall back to the original slower logic if no hits happened. This block of commits also includes updating of existing configurations made with earlier nut-driver-enumerator versions (which do not have those device section names saved into service instance properties).
Another big change here is relocation of some functionality from the CLI processing loop into routines, some of which are now used by other code inside the script.
And a few smaller typos and issues found over time while this was all tested in real life deployments.
CC @geraldguillaume also.
UPDATE: Note to self: I am sure there was some further development about optimizing the script, maybe in 42ity fork, but can't find it at the moment. I think it revolved around detecting
BASH_VERSION
and using bash arrays or hash-maps to store data, for some 30% boost in parser performance on platforms where it is possible.