diff --git a/pyghmi/ipmi/command.py b/pyghmi/ipmi/command.py index eec419be..4be29870 100644 --- a/pyghmi/ipmi/command.py +++ b/pyghmi/ipmi/command.py @@ -451,9 +451,9 @@ class Command(object): rsp['data'] = buffer(rsp['data']) return rsp - def get_diagnostic_data(self, savefile, progress=None): + def get_diagnostic_data(self, savefile, progress=None, autosuffix=False): self.oem_init() - return self._oem.get_diagnostic_data(savefile, progress) + return self._oem.get_diagnostic_data(savefile, progress, autosuffix) def get_description(self): """Get physical attributes for the system, e.g. for GUI use diff --git a/pyghmi/ipmi/oem/lenovo/handler.py b/pyghmi/ipmi/oem/lenovo/handler.py index 436c3d74..c506fd27 100755 --- a/pyghmi/ipmi/oem/lenovo/handler.py +++ b/pyghmi/ipmi/oem/lenovo/handler.py @@ -638,11 +638,11 @@ class OEMHandler(generic.OEMHandler): return self.tsmahandler.get_firmware_inventory(components, raisebypass=False) return super(OEMHandler, self).get_oem_firmware(bmcver, components) - def get_diagnostic_data(self, savefile, progress): + def get_diagnostic_data(self, savefile, progress, autosuffix=False): if self.has_xcc: - return self.immhandler.get_diagnostic_data(savefile, progress) + return self.immhandler.get_diagnostic_data(savefile, progress, autosuffix) if self.is_fpc: - return self.smmhandler.get_diagnostic_data(savefile, progress) + return self.smmhandler.get_diagnostic_data(savefile, progress, autosuffix) def get_oem_capping_enabled(self): if self.has_tsm: diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index 3fd8a82c..6d84c74c 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -950,7 +950,7 @@ class XCCClient(IMMClient): self.weblogout() return True - def get_diagnostic_data(self, savefile, progress=None): + def get_diagnostic_data(self, savefile, progress=None, autosuffix=False): self.wc.grab_json_response('/api/providers/ffdc', {'Generate_FFDC': 1}) percent = 0 @@ -966,6 +966,8 @@ class XCCClient(IMMClient): result = self.wc.grab_json_response('/api/providers/ffdc', {'Generate_FFDC_status': 1}) url = '/ffdc/{0}'.format(result['FileName']) + if autosuffix and not savefile.endswith('.tzz'): + savefile += '.tzz' fd = webclient.FileDownloader(self.wc, url, savefile) fd.start() while fd.isAlive(): diff --git a/pyghmi/redfish/command.py b/pyghmi/redfish/command.py index 039380ba..8608aba6 100644 --- a/pyghmi/redfish/command.py +++ b/pyghmi/redfish/command.py @@ -1610,8 +1610,8 @@ class Command(object): """ return self.oem.update_firmware(file, data, progress, bank) - def get_diagnostic_data(self, savefile, progress=None): - return self.oem.get_diagnostic_data(savefile, progress) + def get_diagnostic_data(self, savefile, progress=None, autosuffix=False): + return self.oem.get_diagnostic_data(savefile, progress, autosuffix) def get_licenses(self): return self.oem.get_licenses() diff --git a/pyghmi/redfish/oem/generic.py b/pyghmi/redfish/oem/generic.py index fb22e212..3740e0d0 100644 --- a/pyghmi/redfish/oem/generic.py +++ b/pyghmi/redfish/oem/generic.py @@ -91,13 +91,15 @@ class OEMHandler(object): } return res[0] - def get_diagnostic_data(self, savefile, progress=None): + def get_diagnostic_data(self, savefile, progress=None, autosuffix=None): """Download diagnostic data about target to a file This should be a payload that the vendor's support team can use to do diagnostics. :param savefile: File object or filename to save to :param progress: Callback to be informed about progress + :param autosuffix: Have the library automatically amend filename per + vendor support requirements. :return: """ raise exc.UnsupportedFunctionality( diff --git a/pyghmi/redfish/oem/lenovo/xcc.py b/pyghmi/redfish/oem/lenovo/xcc.py index eeaae271..efe5aa16 100644 --- a/pyghmi/redfish/oem/lenovo/xcc.py +++ b/pyghmi/redfish/oem/lenovo/xcc.py @@ -681,7 +681,7 @@ class OEMHandler(generic.OEMHandler): return 'complete' return 'pending' - def get_diagnostic_data(self, savefile, progress=None): + def get_diagnostic_data(self, savefile, progress=None, autosuffix=False): self.wc.grab_json_response('/api/providers/ffdc', {'Generate_FFDC': 1}) percent = 0 @@ -697,6 +697,8 @@ class OEMHandler(generic.OEMHandler): result = self.wc.grab_json_response('/api/providers/ffdc', {'Generate_FFDC_status': 1}) url = '/ffdc/{0}'.format(result['FileName']) + if autosuffix and not savefile.endswith('.tzz'): + savefile += '.tzz' fd = webclient.FileDownloader(self.wc, url, savefile) fd.start() while fd.isAlive():