mirror of
https://opendev.org/x/pyghmi
synced 2025-02-27 15:50:22 +00:00
Port fast media list from XCC IPMI plugin
The redfish support may be unacceptably slow for media list. Add an accelerator for that function in the redfish oem extension as well. Change-Id: I066e4e469b6b2a3d534e79cdc8bd061a12b10af0
This commit is contained in:
parent
619893b097
commit
964224e306
@ -24,6 +24,7 @@ import time
|
||||
|
||||
import pyghmi.exceptions as pygexc
|
||||
import pyghmi.ipmi.private.util as util
|
||||
import pyghmi.media as media
|
||||
import pyghmi.redfish.oem.generic as generic
|
||||
import pyghmi.storage as storage
|
||||
from pyghmi.util.parse import parse_time
|
||||
@ -556,6 +557,23 @@ class OEMHandler(generic.OEMHandler):
|
||||
wc.set_header('X-XSRF-TOKEN', wc.cookies['_csrf_token'])
|
||||
return wc
|
||||
|
||||
def list_media(self, fishclient):
|
||||
rt = self.wc.grab_json_response('/api/providers/rp_vm_remote_getdisk')
|
||||
if 'items' in rt:
|
||||
for mt in rt['items']:
|
||||
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']:
|
||||
yield media.Media(mt['filename'])
|
||||
|
||||
def attach_remote_media(self, url, user, password, vmurls):
|
||||
for vmurl in vmurls:
|
||||
if 'EXT' not in vmurl:
|
||||
|
Loading…
x
Reference in New Issue
Block a user