From 99f533b4cbc77857d3eaf3d331bd8a835925fb10 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 22 Sep 2020 14:31:28 -0400 Subject: [PATCH 1/3] Implement redfish resilient discovery for TSM TSM redfish stack has an issue where it refuses to recognize any non-redfish password change. Use redfish to change. Regretably, it takes about 10 seconds for that change to propogate to the practical API, so we have a discovery delay now. --- .../confluent/discovery/handlers/tsm.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/discovery/handlers/tsm.py b/confluent_server/confluent/discovery/handlers/tsm.py index 0fba1b05..69e103f4 100644 --- a/confluent_server/confluent/discovery/handlers/tsm.py +++ b/confluent_server/confluent/discovery/handlers/tsm.py @@ -16,6 +16,7 @@ import confluent.discovery.handlers.generic as generic import confluent.exceptions as exc import confluent.netutil as netutil import confluent.util as util +import eventlet import eventlet.support.greendns import json try: @@ -85,7 +86,22 @@ class NodeHandler(generic.NodeHandler): 'username': self.DEFAULT_USER } if authmode == 2: - rsp, status = wc.grab_json_response_with_status('/api/reset-pass', passchange) + passchange = { + 'Password': self.targpass, + } + rwc = webclient.SecureHTTPConnection( + self.ipaddr, 443, + verifycallback=self.validate_cert) + rwc.set_basic_credentials(authdata['username'], + authdata['password']) + rwc.set_header('If-Match', '*') + rwc.set_header('Content-Type', 'application/json') + rsp, status = rwc.grab_json_response_with_status( + '/redfish/v1/AccountService/Accounts/1', + passchange, method='PATCH') + if status >= 200 and status < 300: + authdata['password'] = self.targpass + eventlet.sleep(10) else: rsp, status = wc.grab_json_response_with_status('/api/reset-pass', urlencode(passchange)) authdata['password'] = self.targpass From 4b7d042f2d71344da59218e3a6d161fc889c62af Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 22 Sep 2020 14:33:58 -0400 Subject: [PATCH 2/3] Have a clause for redfish not yet ready We need redfish, but redfish is slow to boot on TSM.. --- confluent_server/confluent/discovery/handlers/tsm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/confluent_server/confluent/discovery/handlers/tsm.py b/confluent_server/confluent/discovery/handlers/tsm.py index 69e103f4..7f9f80e7 100644 --- a/confluent_server/confluent/discovery/handlers/tsm.py +++ b/confluent_server/confluent/discovery/handlers/tsm.py @@ -102,6 +102,8 @@ class NodeHandler(generic.NodeHandler): if status >= 200 and status < 300: authdata['password'] = self.targpass eventlet.sleep(10) + else: + raise Exception("Redfish may not have been ready yet") else: rsp, status = wc.grab_json_response_with_status('/api/reset-pass', urlencode(passchange)) authdata['password'] = self.targpass From e186eb7319224c9d02f8ad03009ccf3be211da7b Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 24 Sep 2020 08:26:37 -0400 Subject: [PATCH 3/3] Fix problem with autocons autocons needed to open the devnode earlier to have the correct name. Fixes TSM autocons behavior --- confluent_osdeploy/utils/autocons.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/confluent_osdeploy/utils/autocons.c b/confluent_osdeploy/utils/autocons.c index 1d555149..018f43b5 100644 --- a/confluent_osdeploy/utils/autocons.c +++ b/confluent_osdeploy/utils/autocons.c @@ -51,6 +51,7 @@ int main(int argc, char* argv[]) { } else { exit(0); } + ttyf = open(buff, O_RDWR | O_NOCTTY); if (currspeed == SPEED9600) { cspeed = B9600; strcpy(offset, ",9600"); @@ -66,8 +67,6 @@ int main(int argc, char* argv[]) { } else { exit(0); } - printf("%s\n", buff); - ttyf = open(buff, O_RDWR | O_NOCTTY); tcgetattr(ttyf, &tty); if (cspeed) { cfsetospeed(&tty, B115200); @@ -75,6 +74,7 @@ int main(int argc, char* argv[]) { } tcsetattr(ttyf, TCSANOW, &tty); ioctl(ttyf, TIOCCONS, 0); + printf("%s\n", buff); }