From 2b2f73788ad9bbddd4a6e10d20c65fc6e19b45a2 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 13 Jun 2018 15:05:39 -0400 Subject: [PATCH] Restore IMMv2 mount attempts IMMv2 firmware changed two things: -It now requires a referer to mount media -Newer firmware moved from data?set to data/set Change-Id: I4b5b88f993b87e4e769aad82cb161abfb72bfd18 --- pyghmi/ipmi/oem/lenovo/imm.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index e2076b5c..e9af73fe 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -321,14 +321,19 @@ class IMMClient(object): 'RP_VmAllocateMountUrl({0},{1},1,,)'.format( self.username, url): '' }) - result = self.wc.grab_json_response('/data?set', params) + result = self.wc.grab_json_response('/data?set', params, + referer=self.adp_referer) + if not result: + result = self.wc.grab_json_response('/data/set', params, + referer=self.adp_referer) if result['return'] != 'Success': raise Exception(result['reason']) self.weblogout() def detach_remote_media(self): mnt = self.wc.grab_json_response( - '/designs/imm/dataproviders/imm_rp_images.php') + '/designs/imm/dataproviders/imm_rp_images.php', + referer=self.adp_referer) removeurls = [] for item in mnt['items']: if 'urls' in item: @@ -339,7 +344,11 @@ class IMMClient(object): params = urllib.urlencode({ 'RP_VmAllocateUnMountUrl({0},{1},0,)'.format( self.username, url): ''}) - result = self.wc.grab_json_response('/data?set', params) + result = self.wc.grab_json_response('/data?set', params, + referer=self.adp_referer) + if not result: + result = self.wc.grab_json_response('/data/set', params, + referer=self.adp_referer) if result['return'] != 'Success': raise Exception(result['reason']) self.weblogout()