From 6b431491055e6c09240bcca959be2f62fb65a2a0 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 28 Feb 2022 10:59:40 -0500 Subject: [PATCH] Add check for sharedio on reseat Reseat returns success even when it is not performed. Check for shared io blocking prior to actually attempting. This allows us to catch an error the firmware should have. Change-Id: I683382236c0dc0683eba69d36e726056782aab10 --- pyghmi/ipmi/oem/lenovo/nextscale.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pyghmi/ipmi/oem/lenovo/nextscale.py b/pyghmi/ipmi/oem/lenovo/nextscale.py index d89f7686..fd85e056 100644 --- a/pyghmi/ipmi/oem/lenovo/nextscale.py +++ b/pyghmi/ipmi/oem/lenovo/nextscale.py @@ -683,8 +683,23 @@ class SMMClient(object): rsp.read() def reseat_bay(self, bay): + bay = int(bay) + if bay % 2 == 0: + # even node may be unable to reseat based on shared io + try: + rsp = self.ipmicmd.xraw_command(0x32, 0xc5, data=[1]) + except Exception: + rsp = {'data': [1]} + rsp['data'] = bytearray(rsp['data']) + if rsp['data'][0] == 2: # shared io + rsp = self.ipmicmd.xraw_command(0x32, 0xa7, data=[bay - 1]) + rsp['data'] = bytearray(rsp['data']) + if rsp['data'][1] == 0x80: + raise Exception('Unable to reseat bay {0} due to bay {1} ' + 'being on with shared IO'.format( + bay, bay - 1)) self.ipmicmd.xraw_command(netfn=0x32, command=0xa4, - data=[int(bay), 2]) + data=[bay, 2]) def get_diagnostic_data(self, savefile, progress=None, autosuffix=False, variant=None):