From 3d2da22dd25f7659b2d33c1a8414af2a30196ac3 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 25 Mar 2016 13:45:13 -0400 Subject: [PATCH] Implement detach media Allow detaching remote media, the converse of the attach_media call Change-Id: I45c71e02bb817b5c26b4de87b52de90c273ce526 --- pyghmi/ipmi/command.py | 4 ++++ pyghmi/ipmi/oem/generic.py | 3 +++ pyghmi/ipmi/oem/lenovo/handler.py | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/pyghmi/ipmi/command.py b/pyghmi/ipmi/command.py index 62c9d741..c5f031dd 100644 --- a/pyghmi/ipmi/command.py +++ b/pyghmi/ipmi/command.py @@ -1726,3 +1726,7 @@ class Command(object): """ self.oem_init() self._oem.attach_remote_media(url, username, password) + + def detach_remote_media(self): + self.oem_init() + self._oem.detach_remote_media() diff --git a/pyghmi/ipmi/oem/generic.py b/pyghmi/ipmi/oem/generic.py index 5d7e84eb..c31740ed 100644 --- a/pyghmi/ipmi/oem/generic.py +++ b/pyghmi/ipmi/oem/generic.py @@ -224,5 +224,8 @@ class OEMHandler(object): """ return + def detach_remote_media(self): + raise exc.UnsupportedFunctionality() + def attach_remote_media(self, imagename, username, password): raise exc.UnsupportedFunctionality() diff --git a/pyghmi/ipmi/oem/lenovo/handler.py b/pyghmi/ipmi/oem/lenovo/handler.py index 0949e2d3..ee757172 100755 --- a/pyghmi/ipmi/oem/lenovo/handler.py +++ b/pyghmi/ipmi/oem/lenovo/handler.py @@ -676,3 +676,9 @@ class OEMHandler(generic.OEMHandler): imagename, domain, path, host) else: raise + + def detach_remote_media(self): + if self.has_megarac: + self.ipmicmd.xraw_command( + netfn=0x32, command=0x9f, data=(8, 10, 0, 0)) + self.ipmicmd.xraw_command(netfn=0x32, command=0x9f, data=(8, 11))