From 33569423297fbc8aeb9abb766c75508f8e635056 Mon Sep 17 00:00:00 2001 From: luyf5 Date: Mon, 13 Sep 2021 16:16:44 +0800 Subject: [PATCH] Get/Set management controller identifier Changes are from https://gitlab.icelab.lenovo.com/pygcon/pyghmi/commit/d09e23fea99664859bf00f3eae80d8720992d68c#dade58c051d057633b161944993db070adc93aa0 collection of M4 and Kent support - 12032015 Change-Id: Id9db78e0033d746ac7d1d52597045c8a328fa224 --- pyghmi/ipmi/command.py | 15 +++++++++++++-- pyghmi/ipmi/oem/generic.py | 13 +++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/pyghmi/ipmi/command.py b/pyghmi/ipmi/command.py index ec832428..6709db1c 100644 --- a/pyghmi/ipmi/command.py +++ b/pyghmi/ipmi/command.py @@ -1266,10 +1266,16 @@ class Command(object): return self.get_mci() def get_mci(self): - """Get the Management Controller Identifier, per DCMI specification + """Set the management controller identifier. + + Try the OEM command first,if False, then set it per DCMI specification :returns: The identifier as a string """ + self.oem_init() + identifier = self._oem.get_oem_identifier() + if identifier: + return identifier return self._chunkwise_dcmi_fetch(9) def set_hostname(self, hostname): @@ -1287,11 +1293,16 @@ class Command(object): return self.set_mci(hostname) def set_mci(self, mci): - """Set the management controller identifier, per DCMI specification + """Set the management controller identifier. + Try the OEM command first, if False, then set it per DCMI specification """ + self.oem_init() if not isinstance(mci, bytes): mci = mci.encode('utf8') + ret = self._oem.set_oem_identifier(mci) + if ret: + return return self._chunkwise_dcmi_set(0xa, mci + b'\x00') def get_asset_tag(self): diff --git a/pyghmi/ipmi/oem/generic.py b/pyghmi/ipmi/oem/generic.py index 94600e29..9caf3526 100644 --- a/pyghmi/ipmi/oem/generic.py +++ b/pyghmi/ipmi/oem/generic.py @@ -271,6 +271,19 @@ class OEMHandler(object): """ return + def get_oem_identifier(self): + """Get host name + + """ + return None + + def set_oem_identifier(self, name): + """Set host name + + :param name: host name to be set + """ + return False + def detach_remote_media(self): raise exc.UnsupportedFunctionality()