RESTify the remaining components
This commit is contained in:
parent
d43ced176f
commit
4cf3ade10a
|
@ -137,7 +137,7 @@ def api_auth_logout():
|
||||||
#
|
#
|
||||||
@api.route('/api/v1/node', methods=['GET'])
|
@api.route('/api/v1/node', methods=['GET'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_node():
|
def api_node_root():
|
||||||
# Get name limit
|
# Get name limit
|
||||||
if 'limit' in flask.request.values:
|
if 'limit' in flask.request.values:
|
||||||
limit = flask.request.values['limit']
|
limit = flask.request.values['limit']
|
||||||
|
@ -148,7 +148,7 @@ def api_node():
|
||||||
|
|
||||||
@api.route('/api/v1/node/<node>', methods=['GET'])
|
@api.route('/api/v1/node/<node>', methods=['GET'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_node_root(node):
|
def api_node_element(node):
|
||||||
# Same as specifying /node?limit=NODE
|
# Same as specifying /node?limit=NODE
|
||||||
return pvcapi.node_list(node)
|
return pvcapi.node_list(node)
|
||||||
|
|
||||||
|
@ -190,26 +190,26 @@ def api_node_domain_state(node):
|
||||||
#
|
#
|
||||||
@api.route('/api/v1/vm', methods=['GET', 'POST'])
|
@api.route('/api/v1/vm', methods=['GET', 'POST'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_vm():
|
def api_vm_root():
|
||||||
if flask.request.method == 'GET':
|
if flask.request.method == 'GET':
|
||||||
# Get node limit
|
# Get node limit
|
||||||
if 'node' in flask.request.values:
|
if 'node' in flask.request.values:
|
||||||
node = flask.request.values['node']
|
node = flask.request.values['node']
|
||||||
else:
|
else:
|
||||||
node = None
|
node = None
|
||||||
|
|
||||||
# Get state limit
|
# Get state limit
|
||||||
if 'state' in flask.request.values:
|
if 'state' in flask.request.values:
|
||||||
state = flask.request.values['state']
|
state = flask.request.values['state']
|
||||||
else:
|
else:
|
||||||
state = None
|
state = None
|
||||||
|
|
||||||
# Get name limit
|
# Get name limit
|
||||||
if 'limit' in flask.request.values:
|
if 'limit' in flask.request.values:
|
||||||
limit = flask.request.values['limit']
|
limit = flask.request.values['limit']
|
||||||
else:
|
else:
|
||||||
limit = None
|
limit = None
|
||||||
|
|
||||||
return pvcapi.vm_list(node, state, limit)
|
return pvcapi.vm_list(node, state, limit)
|
||||||
|
|
||||||
if flask.request.method == 'POST':
|
if flask.request.method == 'POST':
|
||||||
|
@ -218,24 +218,24 @@ def api_vm():
|
||||||
libvirt_xml = flask.request.values['xml']
|
libvirt_xml = flask.request.values['xml']
|
||||||
else:
|
else:
|
||||||
return flask.jsonify({"message":"ERROR: A Libvirt XML document must be specified."}), 400
|
return flask.jsonify({"message":"ERROR: A Libvirt XML document must be specified."}), 400
|
||||||
|
|
||||||
# Get node name
|
# Get node name
|
||||||
if 'node' in flask.request.values:
|
if 'node' in flask.request.values:
|
||||||
node = flask.request.values['node']
|
node = flask.request.values['node']
|
||||||
else:
|
else:
|
||||||
node = None
|
node = None
|
||||||
|
|
||||||
# Get target selector
|
# Get target selector
|
||||||
if 'selector' in flask.request.values:
|
if 'selector' in flask.request.values:
|
||||||
selector = flask.request.values['selector']
|
selector = flask.request.values['selector']
|
||||||
else:
|
else:
|
||||||
selector = None
|
selector = None
|
||||||
|
|
||||||
return pvcapi.vm_define(vm, libvirt_xml, node, selector)
|
return pvcapi.vm_define(vm, libvirt_xml, node, selector)
|
||||||
|
|
||||||
@api.route('/api/v1/vm/<vm>', methods=['GET', 'POST', 'PUT', 'DELETE'])
|
@api.route('/api/v1/vm/<vm>', methods=['GET', 'POST', 'PUT', 'DELETE'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_vm_root(vm):
|
def api_vm_element(vm):
|
||||||
if flask.request.method == 'GET':
|
if flask.request.method == 'GET':
|
||||||
# Same as specifying /vm?limit=VM
|
# Same as specifying /vm?limit=VM
|
||||||
return pvcapi.vm_list(None, None, vm, is_fuzzy=False)
|
return pvcapi.vm_list(None, None, vm, is_fuzzy=False)
|
||||||
|
@ -246,12 +246,12 @@ def api_vm_root(vm):
|
||||||
|
|
||||||
if flask.request.method == 'PUT':
|
if flask.request.method == 'PUT':
|
||||||
libvirt_xml = flask.request.data
|
libvirt_xml = flask.request.data
|
||||||
|
|
||||||
if 'restart' in flask.request.values and flask.request.values['restart']:
|
if 'restart' in flask.request.values and flask.request.values['restart']:
|
||||||
flag_restart = True
|
flag_restart = True
|
||||||
else:
|
else:
|
||||||
flag_restart = False
|
flag_restart = False
|
||||||
|
|
||||||
return pvcapi.vm_modify(vm, flag_restart, libvirt_xml)
|
return pvcapi.vm_modify(vm, flag_restart, libvirt_xml)
|
||||||
|
|
||||||
if flask.request.method == 'DELETE':
|
if flask.request.method == 'DELETE':
|
||||||
|
@ -285,13 +285,13 @@ def api_vm_state(vm):
|
||||||
def api_vm_node(vm):
|
def api_vm_node(vm):
|
||||||
if flask.request.method == 'GET':
|
if flask.request.method == 'GET':
|
||||||
return "Test", 200
|
return "Test", 200
|
||||||
|
|
||||||
if flask.request.method == 'POST':
|
if flask.request.method == 'POST':
|
||||||
if 'action' in flask.request.values:
|
if 'action' in flask.request.values:
|
||||||
action = flask.request.values['action']
|
action = flask.request.values['action']
|
||||||
else:
|
else:
|
||||||
flask.abort(400)
|
flask.abort(400)
|
||||||
|
|
||||||
# Get node name
|
# Get node name
|
||||||
if 'node' in flask.request.values:
|
if 'node' in flask.request.values:
|
||||||
node = flask.request.values['node']
|
node = flask.request.values['node']
|
||||||
|
@ -331,14 +331,14 @@ def api_vm_node(vm):
|
||||||
#
|
#
|
||||||
@api.route('/api/v1/network', methods=['GET', 'POST'])
|
@api.route('/api/v1/network', methods=['GET', 'POST'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_net():
|
def api_net_root():
|
||||||
if flask.request.method == 'GET':
|
if flask.request.method == 'GET':
|
||||||
# Get name limit
|
# Get name limit
|
||||||
if 'limit' in flask.request.values:
|
if 'limit' in flask.request.values:
|
||||||
limit = flask.request.values['limit']
|
limit = flask.request.values['limit']
|
||||||
else:
|
else:
|
||||||
limit = None
|
limit = None
|
||||||
|
|
||||||
return pvcapi.net_list(limit)
|
return pvcapi.net_list(limit)
|
||||||
|
|
||||||
if flask.request.method == 'POST':
|
if flask.request.method == 'POST':
|
||||||
|
@ -347,13 +347,13 @@ def api_net():
|
||||||
vni = flask.request.values['vni']
|
vni = flask.request.values['vni']
|
||||||
else:
|
else:
|
||||||
return flask.jsonify({"message":"ERROR: A VNI must be specified for the virtual network."}), 520
|
return flask.jsonify({"message":"ERROR: A VNI must be specified for the virtual network."}), 520
|
||||||
|
|
||||||
# Get network description
|
# Get network description
|
||||||
if 'description' in flask.request.values:
|
if 'description' in flask.request.values:
|
||||||
description = flask.request.values['vni']
|
description = flask.request.values['vni']
|
||||||
else:
|
else:
|
||||||
return flask.jsonify({"message":"ERROR: A VNI must be specified for the virtual network."}), 520
|
return flask.jsonify({"message":"ERROR: A VNI must be specified for the virtual network."}), 520
|
||||||
|
|
||||||
# Get network type
|
# Get network type
|
||||||
if 'nettype' in flask.request.values:
|
if 'nettype' in flask.request.values:
|
||||||
nettype = flask.request.values['nettype']
|
nettype = flask.request.values['nettype']
|
||||||
|
@ -361,62 +361,62 @@ def api_net():
|
||||||
return flask.jsonify({"message":"ERROR: A valid nettype must be specified: 'managed' or 'bridged'."}), 520
|
return flask.jsonify({"message":"ERROR: A valid nettype must be specified: 'managed' or 'bridged'."}), 520
|
||||||
else:
|
else:
|
||||||
return flask.jsonify({"message":"ERROR: A nettype must be specified for the virtual network."}), 520
|
return flask.jsonify({"message":"ERROR: A nettype must be specified for the virtual network."}), 520
|
||||||
|
|
||||||
# Get network domain
|
# Get network domain
|
||||||
if 'domain' in flask.request.values:
|
if 'domain' in flask.request.values:
|
||||||
domain = flask.request.values['domain']
|
domain = flask.request.values['domain']
|
||||||
else:
|
else:
|
||||||
domain = None
|
domain = None
|
||||||
|
|
||||||
# Get ipv4 network
|
# Get ipv4 network
|
||||||
if 'ip4_network' in flask.request.values:
|
if 'ip4_network' in flask.request.values:
|
||||||
ip4_network = flask.request.values['ip4_network']
|
ip4_network = flask.request.values['ip4_network']
|
||||||
else:
|
else:
|
||||||
ip4_network = None
|
ip4_network = None
|
||||||
|
|
||||||
# Get ipv4 gateway
|
# Get ipv4 gateway
|
||||||
if 'ip4_gateway' in flask.request.values:
|
if 'ip4_gateway' in flask.request.values:
|
||||||
ip4_gateway = flask.request.values['ip4_gateway']
|
ip4_gateway = flask.request.values['ip4_gateway']
|
||||||
else:
|
else:
|
||||||
ip4_gateway = None
|
ip4_gateway = None
|
||||||
|
|
||||||
# Get ipv6 network
|
# Get ipv6 network
|
||||||
if 'ip6_network' in flask.request.values:
|
if 'ip6_network' in flask.request.values:
|
||||||
ip6_network = flask.request.values['ip6_network']
|
ip6_network = flask.request.values['ip6_network']
|
||||||
else:
|
else:
|
||||||
ip6_network = None
|
ip6_network = None
|
||||||
|
|
||||||
# Get ipv6 gateway
|
# Get ipv6 gateway
|
||||||
if 'ip6_gateway' in flask.request.values:
|
if 'ip6_gateway' in flask.request.values:
|
||||||
ip6_gateway = flask.request.values['ip6_gateway']
|
ip6_gateway = flask.request.values['ip6_gateway']
|
||||||
else:
|
else:
|
||||||
ip6_gateway = None
|
ip6_gateway = None
|
||||||
|
|
||||||
# Get ipv4 DHCP flag
|
# Get ipv4 DHCP flag
|
||||||
if 'dhcp4' in flask.request.values and flask.request.values['dhcp4']:
|
if 'dhcp4' in flask.request.values and flask.request.values['dhcp4']:
|
||||||
dhcp4_flag = True
|
dhcp4_flag = True
|
||||||
else:
|
else:
|
||||||
dhcp4_flag = False
|
dhcp4_flag = False
|
||||||
|
|
||||||
# Get ipv4 DHCP start
|
# Get ipv4 DHCP start
|
||||||
if 'dhcp4_start' in flask.request.values:
|
if 'dhcp4_start' in flask.request.values:
|
||||||
dhcp4_start = flask.request.values['dhcp4_start']
|
dhcp4_start = flask.request.values['dhcp4_start']
|
||||||
else:
|
else:
|
||||||
dhcp4_start = None
|
dhcp4_start = None
|
||||||
|
|
||||||
# Get ipv4 DHCP end
|
# Get ipv4 DHCP end
|
||||||
if 'dhcp4_end' in flask.request.values:
|
if 'dhcp4_end' in flask.request.values:
|
||||||
dhcp4_end = flask.request.values['dhcp4_end']
|
dhcp4_end = flask.request.values['dhcp4_end']
|
||||||
else:
|
else:
|
||||||
dhcp4_end = None
|
dhcp4_end = None
|
||||||
|
|
||||||
return pvcapi.net_add(vni, description, nettype, domain,
|
return pvcapi.net_add(vni, description, nettype, domain,
|
||||||
ip4_network, ip4_gateway, ip6_network, ip6_gateway,
|
ip4_network, ip4_gateway, ip6_network, ip6_gateway,
|
||||||
dhcp4_flag, dhcp4_start, dhcp4_end)
|
dhcp4_flag, dhcp4_start, dhcp4_end)
|
||||||
|
|
||||||
@api.route('/api/v1/network/<network>', methods=['GET', 'PUT', 'DELETE'])
|
@api.route('/api/v1/network/<network>', methods=['GET', 'PUT', 'DELETE'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_net_root(network):
|
def api_net_element(network):
|
||||||
# Same as specifying /network?limit=NETWORK
|
# Same as specifying /network?limit=NETWORK
|
||||||
if flask.request.method == 'GET':
|
if flask.request.method == 'GET':
|
||||||
return pvcapi.net_list(network)
|
return pvcapi.net_list(network)
|
||||||
|
@ -427,55 +427,55 @@ def api_net_root(network):
|
||||||
description = flask.request.values['description']
|
description = flask.request.values['description']
|
||||||
else:
|
else:
|
||||||
description = None
|
description = None
|
||||||
|
|
||||||
# Get network domain
|
# Get network domain
|
||||||
if 'domain' in flask.request.values:
|
if 'domain' in flask.request.values:
|
||||||
domain = flask.request.values['domain']
|
domain = flask.request.values['domain']
|
||||||
else:
|
else:
|
||||||
domain = None
|
domain = None
|
||||||
|
|
||||||
# Get ipv4 network
|
# Get ipv4 network
|
||||||
if 'ip4_network' in flask.request.values:
|
if 'ip4_network' in flask.request.values:
|
||||||
ip4_network = flask.request.values['ip4_network']
|
ip4_network = flask.request.values['ip4_network']
|
||||||
else:
|
else:
|
||||||
ip4_network = None
|
ip4_network = None
|
||||||
|
|
||||||
# Get ipv4 gateway
|
# Get ipv4 gateway
|
||||||
if 'ip4_gateway' in flask.request.values:
|
if 'ip4_gateway' in flask.request.values:
|
||||||
ip4_gateway = flask.request.values['ip4_gateway']
|
ip4_gateway = flask.request.values['ip4_gateway']
|
||||||
else:
|
else:
|
||||||
ip4_gateway = None
|
ip4_gateway = None
|
||||||
|
|
||||||
# Get ipv6 network
|
# Get ipv6 network
|
||||||
if 'ip6_network' in flask.request.values:
|
if 'ip6_network' in flask.request.values:
|
||||||
ip6_network = flask.request.values['ip6_network']
|
ip6_network = flask.request.values['ip6_network']
|
||||||
else:
|
else:
|
||||||
ip6_network = None
|
ip6_network = None
|
||||||
|
|
||||||
# Get ipv6 gateway
|
# Get ipv6 gateway
|
||||||
if 'ip6_gateway' in flask.request.values:
|
if 'ip6_gateway' in flask.request.values:
|
||||||
ip6_gateway = flask.request.values['ip6_gateway']
|
ip6_gateway = flask.request.values['ip6_gateway']
|
||||||
else:
|
else:
|
||||||
ip6_gateway = None
|
ip6_gateway = None
|
||||||
|
|
||||||
# Get ipv4 DHCP flag
|
# Get ipv4 DHCP flag
|
||||||
if 'dhcp4' in flask.request.values and flask.request.values['dhcp4']:
|
if 'dhcp4' in flask.request.values and flask.request.values['dhcp4']:
|
||||||
dhcp4_flag = True
|
dhcp4_flag = True
|
||||||
else:
|
else:
|
||||||
dhcp4_flag = False
|
dhcp4_flag = False
|
||||||
|
|
||||||
# Get ipv4 DHCP start
|
# Get ipv4 DHCP start
|
||||||
if 'dhcp4_start' in flask.request.values:
|
if 'dhcp4_start' in flask.request.values:
|
||||||
dhcp4_start = flask.request.values['dhcp4_start']
|
dhcp4_start = flask.request.values['dhcp4_start']
|
||||||
else:
|
else:
|
||||||
dhcp4_start = None
|
dhcp4_start = None
|
||||||
|
|
||||||
# Get ipv4 DHCP end
|
# Get ipv4 DHCP end
|
||||||
if 'dhcp4_end' in flask.request.values:
|
if 'dhcp4_end' in flask.request.values:
|
||||||
dhcp4_end = flask.request.values['dhcp4_end']
|
dhcp4_end = flask.request.values['dhcp4_end']
|
||||||
else:
|
else:
|
||||||
dhcp4_end = None
|
dhcp4_end = None
|
||||||
|
|
||||||
return pvcapi.net_modify(network, description, domain,
|
return pvcapi.net_modify(network, description, domain,
|
||||||
ip4_network, ip4_gateway,
|
ip4_network, ip4_gateway,
|
||||||
ip6_network, ip6_gateway,
|
ip6_network, ip6_gateway,
|
||||||
|
@ -486,20 +486,20 @@ def api_net_root(network):
|
||||||
|
|
||||||
@api.route('/api/v1/network/<network>/lease', methods=['GET', 'POST'])
|
@api.route('/api/v1/network/<network>/lease', methods=['GET', 'POST'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_net_lease(network):
|
def api_net_lease_root(network):
|
||||||
if flask.request.method == 'GET':
|
if flask.request.method == 'GET':
|
||||||
# Get name limit
|
# Get name limit
|
||||||
if 'limit' in flask.request.values:
|
if 'limit' in flask.request.values:
|
||||||
limit = flask.request.values['limit']
|
limit = flask.request.values['limit']
|
||||||
else:
|
else:
|
||||||
limit = None
|
limit = None
|
||||||
|
|
||||||
# Get static-only flag
|
# Get static-only flag
|
||||||
if 'static' in flask.request.values and flask.request.values['static']:
|
if 'static' in flask.request.values and flask.request.values['static']:
|
||||||
flag_static = True
|
flag_static = True
|
||||||
else:
|
else:
|
||||||
flag_static = False
|
flag_static = False
|
||||||
|
|
||||||
return pvcapi.net_dhcp_list(network, limit. flag_static)
|
return pvcapi.net_dhcp_list(network, limit. flag_static)
|
||||||
|
|
||||||
if flask.request.method == 'POST':
|
if flask.request.method == 'POST':
|
||||||
|
@ -513,18 +513,18 @@ def api_net_lease(network):
|
||||||
ipaddress = flask.request.values['ipaddress']
|
ipaddress = flask.request.values['ipaddress']
|
||||||
else:
|
else:
|
||||||
return flask.jsonify({"message":"ERROR: An IP address must be specified for the lease."}), 400
|
return flask.jsonify({"message":"ERROR: An IP address must be specified for the lease."}), 400
|
||||||
|
|
||||||
# Get lease hostname
|
# Get lease hostname
|
||||||
if 'hostname' in flask.request.values:
|
if 'hostname' in flask.request.values:
|
||||||
hostname = flask.request.values['hostname']
|
hostname = flask.request.values['hostname']
|
||||||
else:
|
else:
|
||||||
hostname = None
|
hostname = None
|
||||||
|
|
||||||
return pvcapi.net_dhcp_add(network, ipaddress, lease, hostname)
|
return pvcapi.net_dhcp_add(network, ipaddress, lease, hostname)
|
||||||
|
|
||||||
@api.route('/api/v1/network/<network>/lease/<lease>', methods=['GET', 'DELETE'])
|
@api.route('/api/v1/network/<network>/lease/<lease>', methods=['GET', 'DELETE'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_net_lease_root(network, lease):
|
def api_net_lease_element(network, lease):
|
||||||
if flask.request.method == 'GET':
|
if flask.request.method == 'GET':
|
||||||
# Same as specifying /network?limit=NETWORK
|
# Same as specifying /network?limit=NETWORK
|
||||||
return pvcapi.net_dhcp_list(network, lease, False)
|
return pvcapi.net_dhcp_list(network, lease, False)
|
||||||
|
@ -534,14 +534,14 @@ def api_net_lease_root(network, lease):
|
||||||
|
|
||||||
@api.route('/api/v1/network/<network>/acl', methods=['GET', 'POST'])
|
@api.route('/api/v1/network/<network>/acl', methods=['GET', 'POST'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_net_acl(network):
|
def api_net_acl_root(network):
|
||||||
if flask.request.method == 'GET':
|
if flask.request.method == 'GET':
|
||||||
# Get name limit
|
# Get name limit
|
||||||
if 'limit' in flask.request.values:
|
if 'limit' in flask.request.values:
|
||||||
limit = flask.request.values['limit']
|
limit = flask.request.values['limit']
|
||||||
else:
|
else:
|
||||||
limit = None
|
limit = None
|
||||||
|
|
||||||
# Get direction limit
|
# Get direction limit
|
||||||
if 'direction' in flask.request.values:
|
if 'direction' in flask.request.values:
|
||||||
direction = flask.request.values['direction']
|
direction = flask.request.values['direction']
|
||||||
|
@ -549,7 +549,7 @@ def api_net_acl(network):
|
||||||
return flash.jsonify({"message":"ERROR: Direction must be either 'in' or 'out'; for both, do not specify a direction."}), 400
|
return flash.jsonify({"message":"ERROR: Direction must be either 'in' or 'out'; for both, do not specify a direction."}), 400
|
||||||
else:
|
else:
|
||||||
direction = None
|
direction = None
|
||||||
|
|
||||||
return pvcapi.net_acl_list(network, limit, direction)
|
return pvcapi.net_acl_list(network, limit, direction)
|
||||||
|
|
||||||
if flask.request.method == 'POST':
|
if flask.request.method == 'POST':
|
||||||
|
@ -558,7 +558,7 @@ def api_net_acl(network):
|
||||||
description = flask.request.values['description']
|
description = flask.request.values['description']
|
||||||
else:
|
else:
|
||||||
return flask.jsonify({"message":"ERROR: A description must be provided."}), 400
|
return flask.jsonify({"message":"ERROR: A description must be provided."}), 400
|
||||||
|
|
||||||
# Get rule direction
|
# Get rule direction
|
||||||
if 'direction' in flask.request.values:
|
if 'direction' in flask.request.values:
|
||||||
direction = flask.request.values['limit']
|
direction = flask.request.values['limit']
|
||||||
|
@ -566,24 +566,24 @@ def api_net_acl(network):
|
||||||
return flask.jsonify({"message":"ERROR: Direction must be either 'in' or 'out'."}), 400
|
return flask.jsonify({"message":"ERROR: Direction must be either 'in' or 'out'."}), 400
|
||||||
else:
|
else:
|
||||||
return flask.jsonify({"message":"ERROR: A direction must be specified for the ACL."}), 400
|
return flask.jsonify({"message":"ERROR: A direction must be specified for the ACL."}), 400
|
||||||
|
|
||||||
# Get rule data
|
# Get rule data
|
||||||
if 'rule' in flask.request.values:
|
if 'rule' in flask.request.values:
|
||||||
rule = flask.request.values['rule']
|
rule = flask.request.values['rule']
|
||||||
else:
|
else:
|
||||||
return flask.jsonify({"message":"ERROR: A valid NFT rule line must be specified for the ACL."}), 400
|
return flask.jsonify({"message":"ERROR: A valid NFT rule line must be specified for the ACL."}), 400
|
||||||
|
|
||||||
# Get order value
|
# Get order value
|
||||||
if 'order' in flask.request.values:
|
if 'order' in flask.request.values:
|
||||||
order = flask.request.values['order']
|
order = flask.request.values['order']
|
||||||
else:
|
else:
|
||||||
order = None
|
order = None
|
||||||
|
|
||||||
return pvcapi.net_acl_add(network, direction, acl, rule, order)
|
return pvcapi.net_acl_add(network, direction, acl, rule, order)
|
||||||
|
|
||||||
@api.route('/api/v1/network/<network>/acl/<acl>', methods=['GET', 'DELETE'])
|
@api.route('/api/v1/network/<network>/acl/<acl>', methods=['GET', 'DELETE'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_net_acl_info(network, acl):
|
def api_net_acl_element(network, acl):
|
||||||
if flask.request.method == 'GET':
|
if flask.request.method == 'GET':
|
||||||
# Same as specifying /network?limit=NETWORK
|
# Same as specifying /network?limit=NETWORK
|
||||||
return pvcapi.net_acl_list(network, acl, None)
|
return pvcapi.net_acl_list(network, acl, None)
|
||||||
|
@ -596,7 +596,7 @@ def api_net_acl_info(network, acl):
|
||||||
return flask.jsonify({"message":"ERROR: Direction must be either 'in' or 'out'."}), 400
|
return flask.jsonify({"message":"ERROR: Direction must be either 'in' or 'out'."}), 400
|
||||||
else:
|
else:
|
||||||
return flask.jsonify({"message":"ERROR: A direction must be specified for the ACL."}), 400
|
return flask.jsonify({"message":"ERROR: A direction must be specified for the ACL."}), 400
|
||||||
|
|
||||||
return pvcapi.net_acl_remove(network, direction, acl)
|
return pvcapi.net_acl_remove(network, direction, acl)
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -622,196 +622,243 @@ def api_ceph_status():
|
||||||
def api_ceph_radosdf():
|
def api_ceph_radosdf():
|
||||||
return pvcapi.ceph_radosdf()
|
return pvcapi.ceph_radosdf()
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/osd', methods=['GET'])
|
@api.route('/api/v1/storage/ceph/cluster-option', methods=['GET', 'POST'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_ceph_osd():
|
def api_ceph_cluster_option():
|
||||||
# Get name limit
|
if flask.request.method == 'GET':
|
||||||
if 'limit' in flask.request.values:
|
pass
|
||||||
limit = flask.request.values['limit']
|
|
||||||
else:
|
|
||||||
limit = None
|
|
||||||
|
|
||||||
return pvcapi.ceph_osd_list(limit)
|
if flask.request.method == 'POST':
|
||||||
|
# Get action
|
||||||
|
if 'action' in flask.request.values:
|
||||||
|
action = flask.request.values['action']
|
||||||
|
if not 'set' in action and not 'unset' in action:
|
||||||
|
return flask.jsonify({"message":"ERROR: Action must be one of: set, unset"}), 400
|
||||||
|
else:
|
||||||
|
return flask.jsonify({"message":"ERROR: An action must be specified."}), 400
|
||||||
|
# Get option
|
||||||
|
if 'option' in flask.request.values:
|
||||||
|
option = flask.request.values['option']
|
||||||
|
else:
|
||||||
|
return flask.jsonify({"message":"ERROR: An option must be specified."}), 400
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/osd/set', methods=['POST'])
|
if action == 'set':
|
||||||
|
return pvcapi.ceph_osd_set(option)
|
||||||
|
if action == 'unset':
|
||||||
|
return pvcapi.ceph_osd_unset(option)
|
||||||
|
|
||||||
|
@api.route('/api/v1/storage/ceph/osd', methods=['GET', 'POST'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_ceph_osd_set():
|
def api_ceph_osd_root():
|
||||||
# Get OSD option
|
if flask.request.method == 'GET':
|
||||||
if 'option' in flask.request.options:
|
# Get name limit
|
||||||
option = flask.request.options['option']
|
if 'limit' in flask.request.values:
|
||||||
else:
|
limit = flask.request.values['limit']
|
||||||
return flask.jsonify({"message":"ERROR: An OSD option must be specified."}), 400
|
else:
|
||||||
|
limit = None
|
||||||
|
|
||||||
return pvcapi.ceph_osd_set(option)
|
return pvcapi.ceph_osd_list(limit)
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/osd/unset', methods=['POST'])
|
if flask.request.method == 'POST':
|
||||||
|
# Get OSD node
|
||||||
|
if 'node' in flask.request.values:
|
||||||
|
node = flask.request.values['node']
|
||||||
|
else:
|
||||||
|
return flask.jsonify({"message":"ERROR: A node must be specified."}), 400
|
||||||
|
|
||||||
|
# Get OSD device
|
||||||
|
if 'device' in flask.request.values:
|
||||||
|
device = flask.request.values['device']
|
||||||
|
else:
|
||||||
|
return flask.jsonify({"message":"ERROR: A block device must be specified."}), 400
|
||||||
|
|
||||||
|
# Get OSD weight
|
||||||
|
if 'weight' in flask.request.values:
|
||||||
|
weight = flask.request.values['weight']
|
||||||
|
else:
|
||||||
|
return flask.jsonify({"message":"ERROR: An OSD weight must be specified."}), 400
|
||||||
|
|
||||||
|
return pvcapi.ceph_osd_add(node, device, weight)
|
||||||
|
|
||||||
|
@api.route('/api/v1/storage/ceph/osd/<osd>', methods=['GET', 'DELETE'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_ceph_osd_unset():
|
def api_ceph_osd_element(osd):
|
||||||
# Get OSD option
|
if flask.request.method == 'GET':
|
||||||
if 'option' in flask.request.options:
|
# Same as specifying /osd?limit=OSD
|
||||||
option = flask.request.options['option']
|
return pvcapi.ceph_osd_list(osd)
|
||||||
else:
|
|
||||||
return flask.jsonify({"message":"ERROR: An OSD option must be specified."}), 400
|
|
||||||
|
|
||||||
return pvcapi.ceph_osd_unset(option)
|
if flask.request.method == 'DELETE':
|
||||||
|
# Verify yes-i-really-mean-it flag
|
||||||
|
if not 'yes_i_really_mean_it' in flask.request.values:
|
||||||
|
return flask.jsonify({"message":"ERROR: This command can have unintended consequences and should not be automated; if you're sure you know what you're doing, resend with the argument 'yes_i_really_mean_it'."}), 400
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/osd/<osd>', methods=['GET'])
|
return pvcapi.ceph_osd_remove(osd)
|
||||||
|
|
||||||
|
@api.route('/api/v1/storage/ceph/osd/<osd>/state', methods=['GET', 'POST'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_ceph_osd_info(osd):
|
def api_ceph_osd_state(osd):
|
||||||
# Same as specifying /osd?limit=OSD
|
if flask.request.method == 'GET':
|
||||||
return pvcapi.ceph_osd_list(osd)
|
pass
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/osd/<node>/add', methods=['POST'])
|
if flask.request.method == 'POST':
|
||||||
|
if 'state' in flask.request.values:
|
||||||
|
state = flask.request.values['state']
|
||||||
|
if not 'in' in state and not 'out' in state:
|
||||||
|
return flask.jsonify({"message":"ERROR: State must be one of: in, out."}), 400
|
||||||
|
else:
|
||||||
|
return flask.jsonify({"message":"ERROR: A state must be specified."}), 400
|
||||||
|
|
||||||
|
if state == 'in':
|
||||||
|
return pvcapi.ceph_osd_in(osd)
|
||||||
|
if state == 'out':
|
||||||
|
return pvcapi.ceph_osd_out(osd)
|
||||||
|
|
||||||
|
@api.route('/api/v1/storage/ceph/pool', methods=['GET', 'POST'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_ceph_osd_add(node):
|
def api_ceph_pool_root():
|
||||||
# Get OSD device
|
if flask.request.method == 'GET':
|
||||||
if 'device' in flask.request.devices:
|
# Get name limit
|
||||||
device = flask.request.devices['device']
|
if 'limit' in flask.request.values:
|
||||||
else:
|
limit = flask.request.values['limit']
|
||||||
return flask.jsonify({"message":"ERROR: A block device must be specified."}), 400
|
else:
|
||||||
|
limit = None
|
||||||
|
|
||||||
|
return pvcapi.ceph_pool_list(limit)
|
||||||
|
|
||||||
# Get OSD weight
|
if flask.request.method == 'POST':
|
||||||
if 'weight' in flask.request.weights:
|
# Get pool name
|
||||||
weight = flask.request.weights['weight']
|
if 'pool' in flask.request.values:
|
||||||
else:
|
pool = flask.request.values['pool']
|
||||||
return flask.jsonify({"message":"ERROR: An OSD weight must be specified."}), 400
|
else:
|
||||||
|
return flask.jsonify({"message":"ERROR: A pool name must be specified."}), 400
|
||||||
|
|
||||||
|
# Get placement groups
|
||||||
|
if 'pgs' in flask.request.values:
|
||||||
|
pgs = flask.request.values['pgs']
|
||||||
|
else:
|
||||||
|
# We default to a very small number; DOCUMENT THIS
|
||||||
|
pgs = 128
|
||||||
|
|
||||||
|
return pvcapi.ceph_pool_add(pool, pgs)
|
||||||
|
|
||||||
return pvcapi.ceph_osd_add(node, device, weight)
|
@api.route('/api/v1/storage/ceph/pool/<pool>', methods=['GET', 'DELETE'])
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/osd/<osd>/remove', methods=['POST'])
|
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_ceph_osd_remove(osd):
|
def api_ceph_pool_element(pool):
|
||||||
# Verify yes-i-really-mean-it flag
|
if flask.request.method == 'GET':
|
||||||
if not 'flag_yes_i_really_mean_it' in flask.request.values:
|
# Same as specifying /pool?limit=POOL
|
||||||
return flask.jsonify({"message":"ERROR: This command can have unintended consequences and should not be automated; if you're sure you know what you're doing, resend with the argument 'flag_yes_i_really_mean_it'."}), 599
|
return pvcapi.ceph_pool_list(pool)
|
||||||
|
|
||||||
return pvcapi.ceph_osd_remove(osd)
|
if flask.request.method == 'DELETE':
|
||||||
|
# Verify yes-i-really-mean-it flag
|
||||||
|
if not 'yes_i_really_mean_it' in flask.request.values:
|
||||||
|
return flask.jsonify({"message":"ERROR: This command can have unintended consequences and should not be automated; if you're sure you know what you're doing, resend with the argument 'yes_i_really_mean_it'."}), 400
|
||||||
|
|
||||||
|
return pvcapi.ceph_pool_remove(pool)
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/osd/<osd>/in', methods=['POST'])
|
@api.route('/api/v1/storage/ceph/volume', methods=['GET', 'POST'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_ceph_osd_in(osd):
|
def api_ceph_volume_root():
|
||||||
return pvcapi.ceph_osd_in(osd)
|
if flask.request.method == 'GET':
|
||||||
|
# Get pool limit
|
||||||
|
if 'pool' in flask.request.values:
|
||||||
|
pool = flask.request.values['pool']
|
||||||
|
else:
|
||||||
|
pool = None
|
||||||
|
|
||||||
|
# Get name limit
|
||||||
|
if 'limit' in flask.request.values:
|
||||||
|
limit = flask.request.values['limit']
|
||||||
|
else:
|
||||||
|
limit = None
|
||||||
|
|
||||||
|
return pvcapi.ceph_volume_list(pool, limit)
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/osd/<osd>/out', methods=['POST'])
|
if flask.request.method == 'POST':
|
||||||
|
# Get volume name
|
||||||
|
if 'volume' in flask.request.values:
|
||||||
|
volume = flask.request.values['volume']
|
||||||
|
else:
|
||||||
|
return flask.jsonify({"message":"ERROR: A volume name must be specified."}), 400
|
||||||
|
|
||||||
|
# Get volume pool
|
||||||
|
if 'pool' in flask.request.values:
|
||||||
|
pool = flask.request.values['pool']
|
||||||
|
else:
|
||||||
|
return flask.jsonify({"message":"ERROR: A pool name must be spcified."}), 400
|
||||||
|
|
||||||
|
# Get volume size
|
||||||
|
if 'size' in flask.request.values:
|
||||||
|
size = flask.request.values['size']
|
||||||
|
else:
|
||||||
|
return flask.jsonify({"message":"ERROR: A volume size in bytes (or with an M/G/T suffix) must be specified."}), 400
|
||||||
|
|
||||||
|
return pvcapi.ceph_volume_add(pool, volume, size)
|
||||||
|
|
||||||
|
@api.route('/api/v1/storage/ceph/volume/<pool>/<volume>', methods=['GET', 'DELETE'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_ceph_osd_out(osd):
|
def api_ceph_volume_element(pool, volume):
|
||||||
return pvcapi.ceph_osd_out(osd)
|
if flask.request.method == 'GET':
|
||||||
|
# Same as specifying /volume?limit=VOLUME
|
||||||
|
return pvcapi.ceph_volume_list(pool, volume)
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/pool', methods=['GET'])
|
if flask.request.method == 'DELETE':
|
||||||
|
return pvcapi.ceph_volume_remove(pool, volume)
|
||||||
|
|
||||||
|
@api.route('/api/v1/storage/ceph/volume/snapshot', methods=['GET', 'POST'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_ceph_pool():
|
def api_ceph_volume_snapshot_root():
|
||||||
# Get name limit
|
if flask.request.method == 'GET':
|
||||||
if 'limit' in flask.request.values:
|
# Get pool limit
|
||||||
limit = flask.request.values['limit']
|
if 'pool' in flask.request.values:
|
||||||
else:
|
pool = flask.request.values['pool']
|
||||||
limit = None
|
else:
|
||||||
|
pool = None
|
||||||
|
|
||||||
|
# Get volume limit
|
||||||
|
if 'volume' in flask.request.values:
|
||||||
|
volume = flask.request.values['volume']
|
||||||
|
else:
|
||||||
|
volume = None
|
||||||
|
|
||||||
|
# Get name limit
|
||||||
|
if 'limit' in flask.request.values:
|
||||||
|
limit = flask.request.values['limit']
|
||||||
|
else:
|
||||||
|
limit = None
|
||||||
|
|
||||||
|
return pvcapi.ceph_volume_snapshot_list(pool, volume, limit)
|
||||||
|
|
||||||
return pvcapi.ceph_pool_list(limit)
|
if flask.request.method == 'POST':
|
||||||
|
# Get snapshot name
|
||||||
|
if 'snapshot' in flask.request.values:
|
||||||
|
snapshot = flask.request.values['snapshot']
|
||||||
|
else:
|
||||||
|
return flask.jsonify({"message":"ERROR: A snapshot name must be specified."}), 400
|
||||||
|
|
||||||
|
# Get volume name
|
||||||
|
if 'volume' in flask.request.values:
|
||||||
|
volume = flask.request.values['volume']
|
||||||
|
else:
|
||||||
|
return flask.jsonify({"message":"ERROR: A volume name must be specified."}), 400
|
||||||
|
|
||||||
|
# Get volume pool
|
||||||
|
if 'pool' in flask.request.values:
|
||||||
|
pool = flask.request.values['pool']
|
||||||
|
else:
|
||||||
|
return flask.jsonify({"message":"ERROR: A pool name must be spcified."}), 400
|
||||||
|
|
||||||
|
return pvcapi.ceph_volume_snapshot_add(pool, volume, snapshot)
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/pool/<pool>', methods=['GET'])
|
|
||||||
|
@api.route('/api/v1/storage/ceph/volume/snapshot/<pool>/<volume>/<snapshot>', methods=['GET', 'DELETE'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_ceph_pool_info(pool):
|
def api_ceph_volume_snapshot_element(pool, volume, snapshot):
|
||||||
# Same as specifying /pool?limit=POOL
|
if flask.request.method == 'GET':
|
||||||
return pvcapi.ceph_pool_list(pool)
|
# Same as specifying /snapshot?limit=VOLUME
|
||||||
|
return pvcapi.ceph_volume_snapshot_list(pool, volume, snapshot)
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/pool/<pool>/add', methods=['POST'])
|
if flask.request.method == 'DELETE':
|
||||||
@authenticator
|
return pvcapi.ceph_volume_snapshot_remove(pool, volume, snapshot)
|
||||||
def api_ceph_pool_add(pool):
|
|
||||||
# Get placement groups
|
|
||||||
if 'pgs' in flask.request.values:
|
|
||||||
pgs = flask.request.values['pgs']
|
|
||||||
else:
|
|
||||||
# We default to a very small number; DOCUMENT THIS
|
|
||||||
pgs = 128
|
|
||||||
|
|
||||||
return pvcapi.ceph_pool_add(pool, pgs)
|
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/pool/<pool>/remove', methods=['POST'])
|
|
||||||
@authenticator
|
|
||||||
def api_ceph_pool_remove(pool):
|
|
||||||
# Verify yes-i-really-mean-it flag
|
|
||||||
if not 'flag_yes_i_really_mean_it' in flask.request.values:
|
|
||||||
return flask.jsonify({"message":"ERROR: This command can have unintended consequences and should not be automated; if you're sure you know what you're doing, resend with the argument 'flag_yes_i_really_mean_it'."}), 599
|
|
||||||
|
|
||||||
return pvcapi.ceph_pool_remove(pool)
|
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/volume', methods=['GET'])
|
|
||||||
@authenticator
|
|
||||||
def api_ceph_volume():
|
|
||||||
# Get pool limit
|
|
||||||
if 'pool' in flask.request.values:
|
|
||||||
pool = flask.request.values['pool']
|
|
||||||
else:
|
|
||||||
pool = None
|
|
||||||
|
|
||||||
# Get name limit
|
|
||||||
if 'limit' in flask.request.values:
|
|
||||||
limit = flask.request.values['limit']
|
|
||||||
else:
|
|
||||||
limit = None
|
|
||||||
|
|
||||||
return pvcapi.ceph_volume_list(pool, limit)
|
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/volume/<pool>/<volume>', methods=['GET'])
|
|
||||||
@authenticator
|
|
||||||
def api_ceph_volume_info(pool, volume):
|
|
||||||
# Same as specifying /volume?limit=VOLUME
|
|
||||||
return pvcapi.ceph_osd_list(pool, osd)
|
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/volume/<pool>/<volume>/add', methods=['POST'])
|
|
||||||
@authenticator
|
|
||||||
def api_ceph_volume_add(pool, volume):
|
|
||||||
# Get volume size
|
|
||||||
if 'size' in flask.request.values:
|
|
||||||
size = flask.request.values['size']
|
|
||||||
else:
|
|
||||||
return flask.jsonify({"message":"ERROR: A volume size in bytes (or with an M/G/T suffix) must be specified."}), 400
|
|
||||||
|
|
||||||
return pvcapi.ceph_volume_add(pool, volume, size)
|
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/volume/<pool>/<volume>/remove', methods=['POST'])
|
|
||||||
@authenticator
|
|
||||||
def api_ceph_volume_remove(pool, volume):
|
|
||||||
return pvcapi.ceph_volume_remove(pool, volume)
|
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/volume/snapshot', methods=['GET'])
|
|
||||||
@authenticator
|
|
||||||
def api_ceph_volume_snapshot():
|
|
||||||
# Get pool limit
|
|
||||||
if 'pool' in flask.request.values:
|
|
||||||
pool = flask.request.values['pool']
|
|
||||||
else:
|
|
||||||
pool = None
|
|
||||||
|
|
||||||
# Get volume limit
|
|
||||||
if 'volume' in flask.request.values:
|
|
||||||
volume = flask.request.values['volume']
|
|
||||||
else:
|
|
||||||
volume = None
|
|
||||||
|
|
||||||
# Get name limit
|
|
||||||
if 'limit' in flask.request.values:
|
|
||||||
limit = flask.request.values['limit']
|
|
||||||
else:
|
|
||||||
limit = None
|
|
||||||
|
|
||||||
return pvcapi.ceph_volume_snapshot_list(pool, volume, limit)
|
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/volume/snapshot/<pool>/<volume>/<snapshot>', methods=['GET'])
|
|
||||||
@authenticator
|
|
||||||
def api_ceph_volume_snapshot_info(pool, volume, snapshot):
|
|
||||||
# Same as specifying /snapshot?limit=VOLUME
|
|
||||||
return pvcapi.ceph_snapshot_list(pool, volume, snapshot)
|
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/volume/snapshot/<pool>/<volume>/<snapshot>/add', methods=['POST'])
|
|
||||||
@authenticator
|
|
||||||
def api_ceph_volume_snapshot_add(pool, volume, snapshot):
|
|
||||||
return pvcapi.ceph_volume_snapshot_add(pool, volume, snapshot)
|
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/volume/snapshot/<pool>/<volume>/<snapshot>/remove', methods=['POST'])
|
|
||||||
@authenticator
|
|
||||||
def api_ceph_volume_snapshot_remove(pool, volume, snapshot):
|
|
||||||
return pvcapi.ceph_volume_snapshot_remove(pool, volume, snapshot)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Entrypoint
|
# Entrypoint
|
||||||
|
|
|
@ -399,7 +399,7 @@ This endpoint is an alias for `/api/v1/storage/ceph`.
|
||||||
Return a JSON document containing information about the current Ceph cluster utilization. The JSON element `ceph_data` contains the raw output of a `rados df` command.
|
Return a JSON document containing information about the current Ceph cluster utilization. The JSON element `ceph_data` contains the raw output of a `rados df` command.
|
||||||
|
|
||||||
#### `/api/v1/storage/ceph/cluster-option`
|
#### `/api/v1/storage/ceph/cluster-option`
|
||||||
* Methods: `POST`
|
* Methods: `GET`, `POST`
|
||||||
* Mandatory values: `action`, `option`
|
* Mandatory values: `action`, `option`
|
||||||
* Optional values: N/A
|
* Optional values: N/A
|
||||||
|
|
||||||
|
@ -418,7 +418,7 @@ Return a JSON document containing information about all Ceph OSDs in the storage
|
||||||
* Mandatory values: `node`, `device`, `weight`
|
* Mandatory values: `node`, `device`, `weight`
|
||||||
* Optional values: N/A
|
* Optional values: N/A
|
||||||
|
|
||||||
Add a new Ceph OSD to PVC node with name `<node>`. `device` must be a valid block device on the specified `<node>`, e.g. `/dev/sdb`. `weight` must be a valid Ceph OSD weight, usually `1.0` if all OSD disks are the same size.
|
Add a new Ceph OSD to PVC node `<node>`. `device` must be a valid block device on the specified `<node>`, e.g. `/dev/sdb`. `weight` must be a valid Ceph OSD weight, usually `1.0` if all OSD disks are the same size.
|
||||||
|
|
||||||
#### `/api/v1/storage/ceph/osd/<osd>`
|
#### `/api/v1/storage/ceph/osd/<osd>`
|
||||||
* Methods: `GET`, `DELETE`
|
* Methods: `GET`, `DELETE`
|
||||||
|
@ -467,7 +467,7 @@ Return a JSON document containing information about all Ceph RBD pools in the st
|
||||||
* Mandatory values: `pool`, `pgs`
|
* Mandatory values: `pool`, `pgs`
|
||||||
* Optional values: N/A
|
* Optional values: N/A
|
||||||
|
|
||||||
Add a new Ceph RBD pool with name `<pool>` to the storage cluster. `pgs` must be a valid number of Placement Groups for the pool, taking into account the number of OSDs and the replication of the pool (`copies=3`). `256` is a safe and sane number of PGs for 3 nodes and 2 disks per node. This value can be grown later via `ceph` commands as required.
|
Add a new Ceph RBD pool `<pool>` to the storage cluster. `pgs` must be a valid number of Placement Groups for the pool, taking into account the number of OSDs and the replication of the pool (`copies=3`). `256` is a safe and sane number of PGs for 3 nodes and 2 disks per node. This value can be grown later via `ceph` commands as required.
|
||||||
|
|
||||||
#### `/api/v1/storage/ceph/pool/<pool>`
|
#### `/api/v1/storage/ceph/pool/<pool>`
|
||||||
* Methods: `GET`, `DELETE`
|
* Methods: `GET`, `DELETE`
|
||||||
|
@ -476,13 +476,13 @@ Add a new Ceph RBD pool with name `<pool>` to the storage cluster. `pgs` must be
|
||||||
* Mandatory values: N/A
|
* Mandatory values: N/A
|
||||||
* Optional values: N/A
|
* Optional values: N/A
|
||||||
|
|
||||||
Return a JSON document containing information about Ceph RBD pool with name `<pool>`. The output is identical to `/api/v1/storage/ceph/pool?limit=<pool>` without fuzzy regex matching.
|
Return a JSON document containing information about Ceph RBD pool `<pool>`. The output is identical to `/api/v1/storage/ceph/pool?limit=<pool>` without fuzzy regex matching.
|
||||||
|
|
||||||
###### `DELETE`
|
###### `DELETE`
|
||||||
* Mandatory values: `yes_i_really_mean_it`
|
* Mandatory values: `yes_i_really_mean_it`
|
||||||
* Optional values: N/A
|
* Optional values: N/A
|
||||||
|
|
||||||
Remove a Ceph RBD pool with name `<pool>` from the storage cluster.
|
Remove a Ceph RBD pool `<pool>` from the storage cluster.
|
||||||
|
|
||||||
**NOTE:** This is a command with potentially dangerous unintended consequences that should not be scripted. To acknowledge the danger, the `yes_i_really_mean_it` must be set or the endpoint will return a failure.
|
**NOTE:** This is a command with potentially dangerous unintended consequences that should not be scripted. To acknowledge the danger, the `yes_i_really_mean_it` must be set or the endpoint will return a failure.
|
||||||
|
|
||||||
|
@ -495,13 +495,13 @@ Remove a Ceph RBD pool with name `<pool>` from the storage cluster.
|
||||||
* Mandatory values: N/A
|
* Mandatory values: N/A
|
||||||
* Optional values: `pool`, `limit`
|
* Optional values: `pool`, `limit`
|
||||||
|
|
||||||
Return a JSON document containing information about all Ceph RBD volumes in the storage cluster. If `pool` is specified, return a JSON document containing information about all Ceph RBD volumes in Ceph RBD pool with name `pool`. If `limit` is specified, return a JSON document containing information about all Ceph RBD volumes with names matching `limit` as fuzzy regex.
|
Return a JSON document containing information about all Ceph RBD volumes in the storage cluster. If `pool` is specified, return a JSON document containing information about all Ceph RBD volumes in Ceph RBD pool `pool`. If `limit` is specified, return a JSON document containing information about all Ceph RBD volumes with names matching `limit` as fuzzy regex.
|
||||||
|
|
||||||
###### `POST`
|
###### `POST`
|
||||||
* Mandatory values: `pool`, `size`
|
* Mandatory values: `volume`, `pool`, `size`
|
||||||
* Optional values: N/A
|
* Optional values: N/A
|
||||||
|
|
||||||
Add a new Ceph RBD volume with name `<volume>` to Ceph RBD pool with name `<pool>`. `size` must be a valid size, in bytes or a single-character metric prefix of bytes, e.g. `1073741824` (1GB), `4096M`, or `20G`.
|
Add a new Ceph RBD volume `<volume>` to Ceph RBD pool `<pool>`. `size` must be a valid size, in bytes or a single-character metric prefix of bytes, e.g. `1073741824` (1GB), `4096M`, or `20G`.
|
||||||
|
|
||||||
#### `/api/v1/storage/ceph/volume/<pool>/<volume>`
|
#### `/api/v1/storage/ceph/volume/<pool>/<volume>`
|
||||||
* Methods: `GET`, `DELETE`
|
* Methods: `GET`, `DELETE`
|
||||||
|
@ -510,13 +510,13 @@ Add a new Ceph RBD volume with name `<volume>` to Ceph RBD pool with name `<pool
|
||||||
* Mandatory values: N/A
|
* Mandatory values: N/A
|
||||||
* Optional values: N/A
|
* Optional values: N/A
|
||||||
|
|
||||||
Return a JSON document containing information about Ceph RBD volume with name `<volume>` in Ceph RBD pool with name `<pool>`. The output is identical to `/api/v1/storage/ceph/volume?pool=<pool>&limit=<volume>` without fuzzy regex matching.
|
Return a JSON document containing information about Ceph RBD volume `<volume>` in Ceph RBD pool `<pool>`. The output is identical to `/api/v1/storage/ceph/volume?pool=<pool>&limit=<volume>` without fuzzy regex matching.
|
||||||
|
|
||||||
###### `DELETE`
|
###### `DELETE`
|
||||||
* Mandatory values: N/A
|
* Mandatory values: N/A
|
||||||
* Optional values: N/A
|
* Optional values: N/A
|
||||||
|
|
||||||
Remove a Ceph RBD volume with name `<volume>` from Ceph RBD pool `<pool>`.
|
Remove a Ceph RBD volume `<volume>` from Ceph RBD pool `<pool>`.
|
||||||
|
|
||||||
#### `/api/v1/storage/ceph/volume/snapshot`
|
#### `/api/v1/storage/ceph/volume/snapshot`
|
||||||
* Methods: `GET`, `POST`
|
* Methods: `GET`, `POST`
|
||||||
|
@ -525,15 +525,15 @@ Remove a Ceph RBD volume with name `<volume>` from Ceph RBD pool `<pool>`.
|
||||||
* Mandatory values: N/A
|
* Mandatory values: N/A
|
||||||
* Optional values: `pool`, `volume`, `limit`
|
* Optional values: `pool`, `volume`, `limit`
|
||||||
|
|
||||||
Return a JSON document containing information about all Ceph RBD volume snapshots in the storage cluster. If `pool` is specified, return a JSON document containing information about all Ceph RBD volume snapshots in Ceph RBD pool with name `pool`. If `volume` is specified, return a JSON document containing information about all Ceph RBD volume snapshots of Ceph RBD volume with name `volume`. If `limit` is specified, return a JSON document containing information about all Ceph RBD volume snapshots with names matching `limit` as fuzzy regex.
|
Return a JSON document containing information about all Ceph RBD volume snapshots in the storage cluster. If `pool` is specified, return a JSON document containing information about all Ceph RBD volume snapshots in Ceph RBD pool `pool`. If `volume` is specified, return a JSON document containing information about all Ceph RBD volume snapshots of Ceph RBD volume `volume`. If `limit` is specified, return a JSON document containing information about all Ceph RBD volume snapshots with names matching `limit` as fuzzy regex.
|
||||||
|
|
||||||
The various limit options can be combined freely, e.g. one can specify a `volume` without `pool`, which would match all snapshots of the named volume(s) regardless of pool, or a `pool` and `limit` without a `volume`, which would match all named snapshots on any volume in `pool`.
|
The various limit options can be combined freely, e.g. one can specify a `volume` without `pool`, which would match all snapshots of the named volume(s) regardless of pool, or a `pool` and `limit` without a `volume`, which would match all named snapshots on any volume in `pool`.
|
||||||
|
|
||||||
###### `POST`
|
###### `POST`
|
||||||
* Mandatory values: `snapshot`, `pool`, `volume`
|
* Mandatory values: `snapshot`, `volume`, `pool`
|
||||||
* Optional values: N/A
|
* Optional values: N/A
|
||||||
|
|
||||||
Add a new Ceph RBD volume snapshot with name `<snapshot>` of Ceph RBD volume with name `<volume>` on Ceph RBD pool with name `<pool>`.
|
Add a new Ceph RBD volume snapshot `snapshot` of Ceph RBD volume `volume` on Ceph RBD pool `pool`.
|
||||||
|
|
||||||
#### `/api/v1/storage/ceph/volume/snapshot/<pool>/<volume>/<snapshot>`
|
#### `/api/v1/storage/ceph/volume/snapshot/<pool>/<volume>/<snapshot>`
|
||||||
* Methods: `GET`, `DELETE`
|
* Methods: `GET`, `DELETE`
|
||||||
|
@ -542,10 +542,10 @@ Add a new Ceph RBD volume snapshot with name `<snapshot>` of Ceph RBD volume wit
|
||||||
* Mandatory values: N/A
|
* Mandatory values: N/A
|
||||||
* Optional values: N/A
|
* Optional values: N/A
|
||||||
|
|
||||||
Return a JSON document containing information about Ceph RBD volume snapshot with name `<snapshot>` of Ceph RBD volume with name `<volume>` in Ceph RBD pool with name `<pool>`. The output is identical to `/api/v1/storage/ceph/volume?pool=<pool>&volume=<volume>&limit=<snapshot>` without fuzzy regex matching.
|
Return a JSON document containing information about Ceph RBD volume snapshot `<snapshot>` of Ceph RBD volume `<volume>` in Ceph RBD pool `<pool>`. The output is identical to `/api/v1/storage/ceph/volume?pool=<pool>&volume=<volume>&limit=<snapshot>` without fuzzy regex matching.
|
||||||
|
|
||||||
###### `DELETE`
|
###### `DELETE`
|
||||||
* Mandatory values: N/A
|
* Mandatory values: N/A
|
||||||
* Optional values: N/A
|
* Optional values: N/A
|
||||||
|
|
||||||
Remove a Ceph RBD volume snapshot with name `<snapshot>` of Ceph RBD volume with name `<volume>` on Ceph RBD pool with name `<pool>`.
|
Remove a Ceph RBD volume snapshot `<snapshot>` of Ceph RBD volume `<volume>` on Ceph RBD pool `<pool>`.
|
||||||
|
|
Loading…
Reference in New Issue