def get_list(args): '''获取ceph资源池列表''' ret_list = [] storage_api = CephStorageAPI() center_api = CenterAPI() if not center_api.center_id_exists(args['center_id']): return {'res': False, 'err': ERR_CENTER_ID} center = center_api.get_center_by_id(args['center_id']) try: if not center.managed_by(args['req_user']): return {'res': False, 'err': ERR_AUTH_PERM} pool_list = storage_api.get_pool_list_by_center_id(args['center_id']) except Exception as e: print(e) raise e for pool in pool_list: ret_list.append({ 'id': pool.id, 'pool': pool.pool, 'type': pool.type, 'center_id': pool.center_id, 'host': pool.host, 'port': pool.port, 'uuid': pool.uuid }) return {'res': True, 'list': ret_list}