async def sr_list(cluster_id: str): """ Get All from Storage Repos """ try: try: session = create_session( _id=cluster_id, get_xen_clusters=Settings.get_xen_clusters() ) except KeyError as key_error: raise HTTPException( status_code=400, detail=f"{key_error} is not a valid path" ) srs = SR.get_all(session=session) __sant_sr = [] sant_sr = __sant_sr.append for sr in srs: sant_sr(serialize(sr)) ret = dict(success=True, data=__sant_sr) session.xenapi.session.logout() return ret except Fault as xml_rpc_error: raise HTTPException( status_code=int(xml_rpc_error.faultCode), detail=xml_rpc_error.faultString, ) except RemoteDisconnected as rd_error: raise HTTPException(status_code=500, detail=rd_error.strerror)
async def sr_list(cluster_id: str): """Get All from Storage Repos""" try: session = create_session(cluster_id, get_xen_clusters=Settings.get_xen_clusters()) srs = SR.get_all(session=session) __sant_sr = await asyncio.gather(*[serialize(sr) for sr in srs]) ret = dict(success=True, data=__sant_sr) session.xenapi.session.logout() return ret except Failure as xenapi_error: raise HTTPException(status_code=500, detail=xenapi_failure_jsonify(xenapi_error)) except Fault as xml_rpc_error: raise HTTPException( status_code=int(xml_rpc_error.faultCode), detail=xml_rpc_error.faultString, ) except RemoteDisconnected as rd_error: raise HTTPException(status_code=500, detail=rd_error.strerror)