Replace retcodes with 400; implement OSD status
This commit is contained in:
parent
4cf3ade10a
commit
17b463afd4
|
@ -41,7 +41,7 @@ def node_list(limit=None):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
return flask.jsonify(retdata), retcode
|
return flask.jsonify(retdata), retcode
|
||||||
|
@ -55,7 +55,7 @@ def node_secondary(node):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -72,7 +72,7 @@ def node_primary(node):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -89,7 +89,7 @@ def node_flush(node):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -106,7 +106,7 @@ def node_ready(node):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -139,7 +139,7 @@ def vm_list(node=None, state=None, limit=None, is_fuzzy=True):
|
||||||
'message': 'VM not found.'
|
'message': 'VM not found.'
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
return flask.jsonify(retdata), retcode
|
return flask.jsonify(retdata), retcode
|
||||||
|
@ -160,7 +160,7 @@ def vm_define(name, xml, node, selector):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -177,7 +177,7 @@ def vm_modify(name, restart, xml):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -194,7 +194,7 @@ def vm_undefine(name):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -211,7 +211,7 @@ def vm_remove(name):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -228,7 +228,7 @@ def vm_start(name):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -245,7 +245,7 @@ def vm_restart(name):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -262,7 +262,7 @@ def vm_shutdown(name):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -279,7 +279,7 @@ def vm_stop(name):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -296,7 +296,7 @@ def vm_move(name, node, selector):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -313,7 +313,7 @@ def vm_migrate(name, node, selector, flag_force):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -330,7 +330,7 @@ def vm_unmigrate(name):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -350,7 +350,7 @@ def net_list(limit=None):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
return flask.jsonify(retdata), retcode
|
return flask.jsonify(retdata), retcode
|
||||||
|
@ -368,7 +368,7 @@ def net_add(vni, description, nettype, domain,
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -390,7 +390,7 @@ def net_modify(vni, description, domain,
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -407,7 +407,7 @@ def net_remove(network):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -424,7 +424,7 @@ def net_dhcp_list(network, limit=None, static=False):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
return flask.jsonify(retdata), retcode
|
return flask.jsonify(retdata), retcode
|
||||||
|
@ -438,7 +438,7 @@ def net_dhcp_add(network, ipaddress, macaddress, hostname):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -455,7 +455,7 @@ def net_dhcp_remove(network, macaddress):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -472,7 +472,7 @@ def net_acl_list(network, limit=None, direction=None):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -489,7 +489,7 @@ def net_acl_add(network, direction, description, rule, order):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -506,7 +506,7 @@ def net_acl_remove(network, direction, description):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -526,7 +526,7 @@ def ceph_status():
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
return flask.jsonify(retdata), retcode
|
return flask.jsonify(retdata), retcode
|
||||||
|
@ -540,7 +540,7 @@ def ceph_radosdf():
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
return flask.jsonify(retdata), retcode
|
return flask.jsonify(retdata), retcode
|
||||||
|
@ -554,11 +554,24 @@ def ceph_osd_list(limit=None):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
return flask.jsonify(retdata), retcode
|
return flask.jsonify(retdata), retcode
|
||||||
|
|
||||||
|
def ceph_osd_state(osd):
|
||||||
|
zk_conn = pvc_common.startZKConnection(config['coordinators'])
|
||||||
|
retflag, retdata = pvc_ceph.get_list_osd(zk_conn, osd)
|
||||||
|
if retflag:
|
||||||
|
retcode = 200
|
||||||
|
else:
|
||||||
|
retcode = 400
|
||||||
|
|
||||||
|
in_state = retdata['stats']['in']
|
||||||
|
up_state = retdata['stats']['up']
|
||||||
|
|
||||||
|
return flask.jsonify([{ "id": osd, "in": in_state, "up": up_state }]), retcode
|
||||||
|
|
||||||
def ceph_osd_add(node, device, weight):
|
def ceph_osd_add(node, device, weight):
|
||||||
"""
|
"""
|
||||||
Add a Ceph OSD to the PVC Ceph storage cluster.
|
Add a Ceph OSD to the PVC Ceph storage cluster.
|
||||||
|
@ -568,7 +581,7 @@ def ceph_osd_add(node, device, weight):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -585,7 +598,7 @@ def ceph_osd_remove(osd_id):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -602,7 +615,7 @@ def ceph_osd_in(osd_id):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -619,7 +632,7 @@ def ceph_osd_out(osd_id):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -636,7 +649,7 @@ def ceph_osd_set(option):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -653,7 +666,7 @@ def ceph_osd_unset(option):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -670,7 +683,7 @@ def ceph_pool_list(limit=None):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
return flask.jsonify(retdata), retcode
|
return flask.jsonify(retdata), retcode
|
||||||
|
@ -684,7 +697,7 @@ def ceph_pool_add(name, pgs):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -701,7 +714,7 @@ def ceph_pool_remove(name):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -718,7 +731,7 @@ def ceph_volume_list(pool=None, limit=None):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
return flask.jsonify(retdata), retcode
|
return flask.jsonify(retdata), retcode
|
||||||
|
@ -732,7 +745,7 @@ def ceph_volume_add(pool, name, size):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -749,7 +762,7 @@ def ceph_volume_remove(pool, name):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -766,7 +779,7 @@ def ceph_volume_snapshot_list(pool=None, volume=None, limit=None):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
return flask.jsonify(retdata), retcode
|
return flask.jsonify(retdata), retcode
|
||||||
|
@ -781,7 +794,7 @@ def ceph_volume_snapshot_add(pool, volume, name):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
@ -798,7 +811,7 @@ def ceph_volume_snapshot_remove(pool, volume, name):
|
||||||
if retflag:
|
if retflag:
|
||||||
retcode = 200
|
retcode = 200
|
||||||
else:
|
else:
|
||||||
retcode = 510
|
retcode = 400
|
||||||
|
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
output = {
|
output = {
|
||||||
|
|
|
@ -622,12 +622,9 @@ 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/cluster-option', methods=['GET', 'POST'])
|
@api.route('/api/v1/storage/ceph/cluster-option', methods=['POST'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_ceph_cluster_option():
|
def api_ceph_cluster_option():
|
||||||
if flask.request.method == 'GET':
|
|
||||||
pass
|
|
||||||
|
|
||||||
if flask.request.method == 'POST':
|
if flask.request.method == 'POST':
|
||||||
# Get action
|
# Get action
|
||||||
if 'action' in flask.request.values:
|
if 'action' in flask.request.values:
|
||||||
|
@ -698,7 +695,7 @@ def api_ceph_osd_element(osd):
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_ceph_osd_state(osd):
|
def api_ceph_osd_state(osd):
|
||||||
if flask.request.method == 'GET':
|
if flask.request.method == 'GET':
|
||||||
pass
|
return pvcapi.ceph_osd_state(osd)
|
||||||
|
|
||||||
if flask.request.method == 'POST':
|
if flask.request.method == 'POST':
|
||||||
if 'state' in flask.request.values:
|
if 'state' in flask.request.values:
|
||||||
|
@ -794,13 +791,17 @@ def api_ceph_volume_root():
|
||||||
|
|
||||||
return pvcapi.ceph_volume_add(pool, volume, size)
|
return pvcapi.ceph_volume_add(pool, volume, size)
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/volume/<pool>/<volume>', methods=['GET', 'DELETE'])
|
@api.route('/api/v1/storage/ceph/volume/<pool>/<volume>', methods=['GET', 'PUT', 'DELETE'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_ceph_volume_element(pool, volume):
|
def api_ceph_volume_element(pool, volume):
|
||||||
if flask.request.method == 'GET':
|
if flask.request.method == 'GET':
|
||||||
# Same as specifying /volume?limit=VOLUME
|
# Same as specifying /volume?limit=VOLUME
|
||||||
return pvcapi.ceph_volume_list(pool, volume)
|
return pvcapi.ceph_volume_list(pool, volume)
|
||||||
|
|
||||||
|
if flask.request.method == 'PUT':
|
||||||
|
# TODO: #44
|
||||||
|
flask.abort(501)
|
||||||
|
|
||||||
if flask.request.method == 'DELETE':
|
if flask.request.method == 'DELETE':
|
||||||
return pvcapi.ceph_volume_remove(pool, volume)
|
return pvcapi.ceph_volume_remove(pool, volume)
|
||||||
|
|
||||||
|
@ -850,13 +851,17 @@ def api_ceph_volume_snapshot_root():
|
||||||
return pvcapi.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>', methods=['GET', 'DELETE'])
|
@api.route('/api/v1/storage/ceph/volume/snapshot/<pool>/<volume>/<snapshot>', methods=['GET', 'PUT', 'DELETE'])
|
||||||
@authenticator
|
@authenticator
|
||||||
def api_ceph_volume_snapshot_element(pool, volume, snapshot):
|
def api_ceph_volume_snapshot_element(pool, volume, snapshot):
|
||||||
if flask.request.method == 'GET':
|
if flask.request.method == 'GET':
|
||||||
# Same as specifying /snapshot?limit=VOLUME
|
# Same as specifying /snapshot?limit=VOLUME
|
||||||
return pvcapi.ceph_volume_snapshot_list(pool, volume, snapshot)
|
return pvcapi.ceph_volume_snapshot_list(pool, volume, snapshot)
|
||||||
|
|
||||||
|
if flask.request.method == 'PUT':
|
||||||
|
# TODO: #44
|
||||||
|
flask.abort(501)
|
||||||
|
|
||||||
if flask.request.method == 'DELETE':
|
if flask.request.method == 'DELETE':
|
||||||
return pvcapi.ceph_volume_snapshot_remove(pool, volume, snapshot)
|
return pvcapi.ceph_volume_snapshot_remove(pool, volume, snapshot)
|
||||||
|
|
||||||
|
|
|
@ -386,6 +386,8 @@ Return a JSON document containing information about the current Ceph cluster sta
|
||||||
|
|
||||||
#### `/api/v1/storage/ceph/status`
|
#### `/api/v1/storage/ceph/status`
|
||||||
* Methods: `GET`
|
* Methods: `GET`
|
||||||
|
|
||||||
|
###### `GET`
|
||||||
* Mandatory values: N/A
|
* Mandatory values: N/A
|
||||||
* Optional values: N/A
|
* Optional values: N/A
|
||||||
|
|
||||||
|
@ -393,13 +395,17 @@ This endpoint is an alias for `/api/v1/storage/ceph`.
|
||||||
|
|
||||||
#### `/api/v1/storage/ceph/df`
|
#### `/api/v1/storage/ceph/df`
|
||||||
* Methods: `GET`
|
* Methods: `GET`
|
||||||
|
|
||||||
|
###### `GET`
|
||||||
* Mandatory values: N/A
|
* Mandatory values: N/A
|
||||||
* Optional values: N/A
|
* Optional values: N/A
|
||||||
|
|
||||||
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: `GET`, `POST`
|
* Methods: `POST`
|
||||||
|
|
||||||
|
###### `POST`
|
||||||
* Mandatory values: `action`, `option`
|
* Mandatory values: `action`, `option`
|
||||||
* Optional values: N/A
|
* Optional values: N/A
|
||||||
|
|
||||||
|
@ -504,7 +510,7 @@ Return a JSON document containing information about all Ceph RBD volumes in the
|
||||||
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`.
|
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`, `PUT`, `DELETE`
|
||||||
|
|
||||||
###### `GET`
|
###### `GET`
|
||||||
* Mandatory values: N/A
|
* Mandatory values: N/A
|
||||||
|
@ -512,6 +518,12 @@ Add a new Ceph RBD volume `<volume>` to Ceph RBD pool `<pool>`. `size` must be a
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
###### `PUT`
|
||||||
|
* Mandatory values: N/A
|
||||||
|
* Optional values: `name`, `size`
|
||||||
|
|
||||||
|
Change the configuration of the volume `<volume>`. If `name` is specified, rename the volume to the specified name. If `size` is specified, resize the volume to the specified size (see `POST /api/v1/storage/ceph/volume` for restrictions).
|
||||||
|
|
||||||
###### `DELETE`
|
###### `DELETE`
|
||||||
* Mandatory values: N/A
|
* Mandatory values: N/A
|
||||||
* Optional values: N/A
|
* Optional values: N/A
|
||||||
|
|
Loading…
Reference in New Issue