2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-27 19:37:44 +00:00

Enable OEM diag filename modification

This allows vendors to designate filename for improved compatibility
with support.

Change-Id: Ie855e5ff315000cfdc4e2c9a58f467a2c1f9529c
This commit is contained in:
Jarrod Johnson 2019-10-22 14:59:05 -04:00
parent 0c20d79a8c
commit 284bebb00e
6 changed files with 16 additions and 10 deletions

View File

@ -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

View File

@ -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:

View File

@ -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():

View File

@ -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()

View File

@ -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(

View File

@ -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():