From 84963baacb5fea6592bcb69bf820bd6f2b10a8e1 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 26 Feb 2018 14:50:43 -0500 Subject: [PATCH] Fix media urls URLs do not come naturally out of the XCC. Do some fixup to provide symmetry in the pyghmi api for non-http remote media. Change-Id: I0bf982eb64d39e90e4ef56d753fbc0a4d6fa562d --- pyghmi/ipmi/oem/lenovo/imm.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index a5b52f47..da14c781 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -1011,7 +1011,14 @@ class XCCClient(IMMClient): rt = self.wc.grab_json_response('/api/providers/rp_vm_remote_getdisk') if 'items' in rt: for mt in rt['items']: - yield media.Media(mt['filename'], mt['remotepath']) + url = mt['remotepath'] + if url.startswith('//'): + url = 'smb:' + url + elif (not url.startswith('http://') and + not url.startswith('https://')): + url = url.replace(':', '') + url = 'nfs://' + url + yield media.Media(mt['filename'], url) rt = self.wc.grab_json_response('/api/providers/rp_rdoc_imagelist') if 'items' in rt: for mt in rt['items']: