mirror of
https://opendev.org/x/pyghmi
synced 2025-03-21 10:57:43 +00:00
Try generic method for media attach
If OEM does not handle the mount, try a generic way instead. Change-Id: I19ce70796d270f32718e1d41c01388afe9795a0d
This commit is contained in:
parent
ea676265a1
commit
77daf6817e
@ -1390,7 +1390,16 @@ class Command(object):
|
||||
if vmcoll:
|
||||
vmlist = self._do_web_request(vmcoll)
|
||||
vmurls = [x['@odata.id'] for x in vmlist.get('Members', [])]
|
||||
return self.oem.attach_remote_media(url, username, password, vmurls)
|
||||
try:
|
||||
self.oem.attach_remote_media(url, username, password, vmurls)
|
||||
except exc.BypassGenericBehavior:
|
||||
return
|
||||
for vmurl in vmurls:
|
||||
vminfo = self._do_web_request(vmurl, cache=False)
|
||||
if vminfo['ConnectedVia'] != 'NotConnected':
|
||||
continue
|
||||
self._do_web_request(vmurl, {'Image': url, 'Inserted': True}, 'PATCH')
|
||||
break
|
||||
|
||||
def detach_remote_media(self):
|
||||
bmcinfo = self._do_web_request(self._bmcurl)
|
||||
@ -1401,7 +1410,7 @@ class Command(object):
|
||||
for vminfo in self._do_bulk_requests(vmurls):
|
||||
vminfo, currl = vminfo
|
||||
if vminfo['Image']:
|
||||
self._do_web_request(currl, {'Image': None}, method='PATCH')
|
||||
self._do_web_request(currl, {'Image': None, 'Inserted': False}, method='PATCH')
|
||||
|
||||
def upload_media(self, filename, progress=None):
|
||||
"""Upload a file to be hosted on the target BMC
|
||||
|
@ -436,6 +436,7 @@ class OEMHandler(generic.OEMHandler):
|
||||
if vminfo['ConnectedVia'] != 'NotConnected':
|
||||
continue
|
||||
self._do_web_request(vmurl, {'Image': url, 'Inserted': True}, 'PATCH')
|
||||
raise pygexc.BypassGenericBehavior()
|
||||
break
|
||||
|
||||
def upload_media(self, filename, progress=None):
|
||||
|
Loading…
x
Reference in New Issue
Block a user