Add SRIOV PF and VF listing to API
This commit is contained in:
@ -978,6 +978,62 @@ def net_acl_remove(zkhandler, network, description):
|
||||
return output, retcode
|
||||
|
||||
|
||||
#
|
||||
# SR-IOV functions
|
||||
#
|
||||
@ZKConnection(config)
|
||||
def sriov_pf_list(zkhandler, node):
|
||||
"""
|
||||
List all PFs on a given node.
|
||||
"""
|
||||
retflag, retdata = pvc_network.get_list_sriov_pf(zkhandler, node)
|
||||
|
||||
if retflag:
|
||||
if retdata:
|
||||
retcode = 200
|
||||
else:
|
||||
retcode = 404
|
||||
retdata = {
|
||||
'message': 'PF not found.'
|
||||
}
|
||||
else:
|
||||
retcode = 400
|
||||
retdata = {
|
||||
'message': retdata
|
||||
}
|
||||
|
||||
return retdata, retcode
|
||||
|
||||
|
||||
@ZKConnection(config)
|
||||
def sriov_vf_list(zkhandler, node, pf=None):
|
||||
"""
|
||||
List all VFs on a given node, optionally limited to PF.
|
||||
"""
|
||||
retflag, retdata = pvc_network.get_list_sriov_vf(zkhandler, node, pf)
|
||||
|
||||
if retflag:
|
||||
retcode = 200
|
||||
else:
|
||||
retcode = 400
|
||||
|
||||
if retflag:
|
||||
if retdata:
|
||||
retcode = 200
|
||||
else:
|
||||
retcode = 404
|
||||
retdata = {
|
||||
'message': 'VF not found.'
|
||||
}
|
||||
else:
|
||||
retcode = 400
|
||||
retdata = {
|
||||
'message': retdata
|
||||
}
|
||||
|
||||
return retdata, retcode
|
||||
|
||||
|
||||
#
|
||||
# Ceph functions
|
||||
#
|
||||
|
Reference in New Issue
Block a user