From a97bd5ed378cc08222d8c64dcdd3fcc67cf60cb1 Mon Sep 17 00:00:00 2001 From: Albert Chu Date: Mon, 26 Feb 2024 16:22:25 -0800 Subject: [PATCH] powerman: do not always call "all" query script Problem: When selecting a script to use for an action, the "all" version of a script is always used if the action is a query action (e.g. power status query, beacon query, etc.). This can be problematic in situations where blades/nodes/etc. are not fully populated, such as in a chassis. We do not want to query "all" things in that case. Solution: Only call the "all" script if it is a query and a singlet version of the script does not exist. For device files where unpopulated nodes may exist, it can define an all script and singlet script for each scenario. --- src/powerman/device.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/powerman/device.c b/src/powerman/device.c index 067d31ba..f18757ea 100644 --- a/src/powerman/device.c +++ b/src/powerman/device.c @@ -683,8 +683,12 @@ static int _enqueue_targeted_actions(Device * dev, int com, hostlist_t hl, pluglist_iterator_destroy(itr); /* Try _all version of script. + * + * - use if action is a query, unless no singlet version exists + * (i.e. if there is no singlet version, we have to use the _all + * version) */ - if (all || _is_query_action(com)) { + if (all || (_is_query_action(com) && dev->scripts[com] == NULL)) { int ncom = _get_all_script(dev, com); if (ncom != -1) {