From c3176ab86a5bcca1849b0347fb2b997a23ac2119 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 5 Aug 2019 16:22:50 -0400 Subject: [PATCH] Add blink and identify reporting to redfish --- confluent_client/bin/nodeidentify | 5 +---- confluent_client/confluent_env.sh | 2 +- confluent_client/doc/man/nodeidentify.ronn | 3 ++- confluent_server/confluent/messages.py | 1 + .../confluent/plugins/hardwaremanagement/ipmi.py | 3 +++ .../confluent/plugins/hardwaremanagement/redfish.py | 7 ++++--- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/confluent_client/bin/nodeidentify b/confluent_client/bin/nodeidentify index cc86ee32..32f7f82f 100755 --- a/confluent_client/bin/nodeidentify +++ b/confluent_client/bin/nodeidentify @@ -31,7 +31,7 @@ if path.startswith('/opt'): import confluent.client as client -argparser = optparse.OptionParser(usage="Usage: %prog [on|off]") +argparser = optparse.OptionParser(usage="Usage: %prog [on|off|blink]") (options, args) = argparser.parse_args() try: noderange = args[0] @@ -42,9 +42,6 @@ client.check_globbing(noderange) identifystate = None if len(sys.argv) > 2: identifystate = sys.argv[2] -else: - argparser.print_help() - sys.exit(1) session = client.Command() exitcode = 0 sys.exit( diff --git a/confluent_client/confluent_env.sh b/confluent_client/confluent_env.sh index 2cb8b6be..090b2fc9 100644 --- a/confluent_client/confluent_env.sh +++ b/confluent_client/confluent_env.sh @@ -84,7 +84,7 @@ function _confluent_generic_completion() } _confluent_nodeidentify_completion() { - COMP_CANDIDATES=("on,off -h") + COMP_CANDIDATES=("on,off,blink -h") _confluent_generic_completion } diff --git a/confluent_client/doc/man/nodeidentify.ronn b/confluent_client/doc/man/nodeidentify.ronn index 3a9cbe69..a0b08044 100644 --- a/confluent_client/doc/man/nodeidentify.ronn +++ b/confluent_client/doc/man/nodeidentify.ronn @@ -3,7 +3,7 @@ nodeidentify(8) -- Control the identify LED of confluent nodes ## SYNOPSIS -`nodidentify [on|off]` +`nodidentify [on|off|blink]` ## DESCRIPTION @@ -13,6 +13,7 @@ options are supported: * `on`: Turn on the identify LED * `off`: Turn off the identify LED +* `blink`: Set the identify LED to blink (when supported by the system) ## EXAMPLES: diff --git a/confluent_server/confluent/messages.py b/confluent_server/confluent/messages.py index 36213d28..3590919e 100644 --- a/confluent_server/confluent/messages.py +++ b/confluent_server/confluent/messages.py @@ -822,6 +822,7 @@ class InputIdentifyMessage(ConfluentInputMessage): valid_values = set([ 'on', 'off', + 'blink', ]) keyname = 'identify' diff --git a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py index a27fe007..400cb19e 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py @@ -1296,6 +1296,9 @@ class IpmiHandler(object): def identify(self): if 'update' == self.op: identifystate = self.inputdata.inputbynode[self.node] == 'on' + if self.inputdata.inputbynode[self.node] == 'blink': + raise exc.InvalidArgumentException( + '"blink" is not supported with ipmi') self.ipmicmd.set_identify(on=identifystate) self.output.put(msg.IdentifyState( node=self.node, state=self.inputdata.inputbynode[self.node])) diff --git a/confluent_server/confluent/plugins/hardwaremanagement/redfish.py b/confluent_server/confluent/plugins/hardwaremanagement/redfish.py index 4f893a27..e4506a91 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/redfish.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/redfish.py @@ -1163,13 +1163,14 @@ class IpmiHandler(object): def identify(self): if 'update' == self.op: identifystate = self.inputdata.inputbynode[self.node] == 'on' - self.ipmicmd.set_identify(on=identifystate) + blinkstate = self.inputdata.inputbynode[self.node] == 'blink' + self.ipmicmd.set_identify(on=identifystate, blink=blinkstate) self.output.put(msg.IdentifyState( node=self.node, state=self.inputdata.inputbynode[self.node])) return elif 'read' == self.op: - # ipmi has identify as read-only for now - self.output.put(msg.IdentifyState(node=self.node, state='')) + identify = self.ipmicmd.get_identify().get('identifystate', '') + self.output.put(msg.IdentifyState(node=self.node, state=identify)) return def power(self):