mirror of
https://opendev.org/x/pyghmi
synced 2026-04-01 07:43:39 +00:00
Fix RDOC upload of large images
Large images take some time before they can be mounted. Track the size field to see when the file is actually done copying. Change-Id: I23c921798d6be4370e7314822d37fba1cb9faad3
This commit is contained in:
@@ -366,6 +366,7 @@ class OEMHandler(generic.OEMHandler):
|
||||
self.oemid['product_id'])
|
||||
|
||||
tsma_ids = ((19046, 32, 1287),)
|
||||
|
||||
@property
|
||||
def has_tsma(self):
|
||||
currid = (self.oemid['manufacturer_id'], self.oemid['device_id'],
|
||||
|
||||
@@ -1647,10 +1647,14 @@ class XCCClient(IMMClient):
|
||||
if rsp.get('return', -1) != 0:
|
||||
errmsg = repr(rsp) if rsp else self.wc.lastjsonerror
|
||||
raise Exception('Unrecognized return: ' + errmsg)
|
||||
rsp = self.wc.grab_json_response('/api/providers/rp_rdoc_getfiles')
|
||||
if 'items' not in rsp or len(rsp['items']) == 0:
|
||||
raise Exception(
|
||||
'Image upload was not accepted, it may be too large')
|
||||
ready = False
|
||||
while not ready:
|
||||
ipmisession.Session.pause(3)
|
||||
rsp = self.wc.grab_json_response('/api/providers/rp_rdoc_getfiles')
|
||||
if 'items' not in rsp or len(rsp['items']) == 0:
|
||||
raise Exception(
|
||||
'Image upload was not accepted, it may be too large')
|
||||
ready = rsp['items'][0]['size'] != 0
|
||||
self._refresh_token()
|
||||
rsp = self.wc.grab_json_response('/api/providers/rp_rdoc_mountall',
|
||||
{})
|
||||
|
||||
@@ -520,10 +520,14 @@ class OEMHandler(generic.OEMHandler):
|
||||
if rsp.get('return', -1) != 0:
|
||||
errmsg = repr(rsp) if rsp else self.wc.lastjsonerror
|
||||
raise Exception('Unrecognized return: ' + errmsg)
|
||||
rsp = self.wc.grab_json_response('/api/providers/rp_rdoc_getfiles')
|
||||
if 'items' not in rsp or len(rsp['items']) == 0:
|
||||
raise Exception(
|
||||
'Image upload was not accepted, it may be too large')
|
||||
ready = False
|
||||
while not ready:
|
||||
time.sleep(3)
|
||||
rsp = self.wc.grab_json_response('/api/providers/rp_rdoc_getfiles')
|
||||
if 'items' not in rsp or len(rsp['items']) == 0:
|
||||
raise Exception(
|
||||
'Image upload was not accepted, it may be too large')
|
||||
ready = rsp['items'][0]['size'] != 0
|
||||
self._refresh_token()
|
||||
rsp = self.wc.grab_json_response('/api/providers/rp_rdoc_mountall',
|
||||
{})
|
||||
|
||||
Reference in New Issue
Block a user