Remove junk whitespace
This commit is contained in:
parent
1872489b1d
commit
4937c01075
|
@ -719,7 +719,7 @@ def api_ceph_pool_root():
|
||||||
limit = flask.request.values['limit']
|
limit = flask.request.values['limit']
|
||||||
else:
|
else:
|
||||||
limit = None
|
limit = None
|
||||||
|
|
||||||
return pvcapi.ceph_pool_list(limit)
|
return pvcapi.ceph_pool_list(limit)
|
||||||
|
|
||||||
if flask.request.method == 'POST':
|
if flask.request.method == 'POST':
|
||||||
|
@ -728,14 +728,14 @@ def api_ceph_pool_root():
|
||||||
pool = flask.request.values['pool']
|
pool = flask.request.values['pool']
|
||||||
else:
|
else:
|
||||||
return flask.jsonify({"message":"ERROR: A pool name must be specified."}), 400
|
return flask.jsonify({"message":"ERROR: A pool name must be specified."}), 400
|
||||||
|
|
||||||
# Get placement groups
|
# Get placement groups
|
||||||
if 'pgs' in flask.request.values:
|
if 'pgs' in flask.request.values:
|
||||||
pgs = flask.request.values['pgs']
|
pgs = flask.request.values['pgs']
|
||||||
else:
|
else:
|
||||||
# We default to a very small number; DOCUMENT THIS
|
# We default to a very small number; DOCUMENT THIS
|
||||||
pgs = 128
|
pgs = 128
|
||||||
|
|
||||||
return pvcapi.ceph_pool_add(pool, pgs)
|
return pvcapi.ceph_pool_add(pool, pgs)
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/pool/<pool>', methods=['GET', 'DELETE'])
|
@api.route('/api/v1/storage/ceph/pool/<pool>', methods=['GET', 'DELETE'])
|
||||||
|
@ -749,7 +749,7 @@ def api_ceph_pool_element(pool):
|
||||||
# Verify yes-i-really-mean-it flag
|
# Verify yes-i-really-mean-it flag
|
||||||
if not 'yes_i_really_mean_it' in flask.request.values:
|
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 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)
|
return pvcapi.ceph_pool_remove(pool)
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/volume', methods=['GET', 'POST'])
|
@api.route('/api/v1/storage/ceph/volume', methods=['GET', 'POST'])
|
||||||
|
@ -761,13 +761,13 @@ def api_ceph_volume_root():
|
||||||
pool = flask.request.values['pool']
|
pool = flask.request.values['pool']
|
||||||
else:
|
else:
|
||||||
pool = None
|
pool = 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.ceph_volume_list(pool, limit)
|
return pvcapi.ceph_volume_list(pool, limit)
|
||||||
|
|
||||||
if flask.request.method == 'POST':
|
if flask.request.method == 'POST':
|
||||||
|
@ -776,19 +776,19 @@ def api_ceph_volume_root():
|
||||||
volume = flask.request.values['volume']
|
volume = flask.request.values['volume']
|
||||||
else:
|
else:
|
||||||
return flask.jsonify({"message":"ERROR: A volume name must be specified."}), 400
|
return flask.jsonify({"message":"ERROR: A volume name must be specified."}), 400
|
||||||
|
|
||||||
# Get volume pool
|
# Get volume pool
|
||||||
if 'pool' in flask.request.values:
|
if 'pool' in flask.request.values:
|
||||||
pool = flask.request.values['pool']
|
pool = flask.request.values['pool']
|
||||||
else:
|
else:
|
||||||
return flask.jsonify({"message":"ERROR: A pool name must be spcified."}), 400
|
return flask.jsonify({"message":"ERROR: A pool name must be spcified."}), 400
|
||||||
|
|
||||||
# Get volume size
|
# Get volume size
|
||||||
if 'size' in flask.request.values:
|
if 'size' in flask.request.values:
|
||||||
size = flask.request.values['size']
|
size = flask.request.values['size']
|
||||||
else:
|
else:
|
||||||
return flask.jsonify({"message":"ERROR: A volume size in bytes (or with an M/G/T suffix) must be specified."}), 400
|
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)
|
return pvcapi.ceph_volume_add(pool, volume, size)
|
||||||
|
|
||||||
@api.route('/api/v1/storage/ceph/volume/<pool>/<volume>', methods=['GET', 'PUT', 'DELETE'])
|
@api.route('/api/v1/storage/ceph/volume/<pool>/<volume>', methods=['GET', 'PUT', 'DELETE'])
|
||||||
|
@ -806,8 +806,8 @@ def api_ceph_volume_element(pool, volume):
|
||||||
name = flask.request.values['name']
|
name = flask.request.values['name']
|
||||||
|
|
||||||
if size and not name:
|
if size and not name:
|
||||||
return pvcapi.ceph_volume_resize(pool, volume, size)
|
return pvcapi.ceph_volume_resize(pool, volume, size)
|
||||||
|
|
||||||
if name and not size:
|
if name and not size:
|
||||||
return pvcapi.ceph_volume_rename(pool, volume, name)
|
return pvcapi.ceph_volume_rename(pool, volume, name)
|
||||||
|
|
||||||
|
@ -825,19 +825,19 @@ def api_ceph_volume_snapshot_root():
|
||||||
pool = flask.request.values['pool']
|
pool = flask.request.values['pool']
|
||||||
else:
|
else:
|
||||||
pool = None
|
pool = None
|
||||||
|
|
||||||
# Get volume limit
|
# Get volume limit
|
||||||
if 'volume' in flask.request.values:
|
if 'volume' in flask.request.values:
|
||||||
volume = flask.request.values['volume']
|
volume = flask.request.values['volume']
|
||||||
else:
|
else:
|
||||||
volume = None
|
volume = 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.ceph_volume_snapshot_list(pool, volume, limit)
|
return pvcapi.ceph_volume_snapshot_list(pool, volume, limit)
|
||||||
|
|
||||||
if flask.request.method == 'POST':
|
if flask.request.method == 'POST':
|
||||||
|
@ -846,19 +846,19 @@ def api_ceph_volume_snapshot_root():
|
||||||
snapshot = flask.request.values['snapshot']
|
snapshot = flask.request.values['snapshot']
|
||||||
else:
|
else:
|
||||||
return flask.jsonify({"message":"ERROR: A snapshot name must be specified."}), 400
|
return flask.jsonify({"message":"ERROR: A snapshot name must be specified."}), 400
|
||||||
|
|
||||||
# Get volume name
|
# Get volume name
|
||||||
if 'volume' in flask.request.values:
|
if 'volume' in flask.request.values:
|
||||||
volume = flask.request.values['volume']
|
volume = flask.request.values['volume']
|
||||||
else:
|
else:
|
||||||
return flask.jsonify({"message":"ERROR: A volume name must be specified."}), 400
|
return flask.jsonify({"message":"ERROR: A volume name must be specified."}), 400
|
||||||
|
|
||||||
# Get volume pool
|
# Get volume pool
|
||||||
if 'pool' in flask.request.values:
|
if 'pool' in flask.request.values:
|
||||||
pool = flask.request.values['pool']
|
pool = flask.request.values['pool']
|
||||||
else:
|
else:
|
||||||
return flask.jsonify({"message":"ERROR: A pool name must be spcified."}), 400
|
return flask.jsonify({"message":"ERROR: A pool name must be spcified."}), 400
|
||||||
|
|
||||||
return pvcapi.ceph_volume_snapshot_add(pool, volume, snapshot)
|
return pvcapi.ceph_volume_snapshot_add(pool, volume, snapshot)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ def get_radosdf(zk_conn):
|
||||||
'ceph_data': ceph_df
|
'ceph_data': ceph_df
|
||||||
}
|
}
|
||||||
return True, status_data
|
return True, status_data
|
||||||
|
|
||||||
def format_raw_output(status_data):
|
def format_raw_output(status_data):
|
||||||
click.echo('{bold}Ceph cluster {stype} (primary node {end}{blue}{primary}{end}{bold}){end}\n'.format(bold=ansiprint.bold(), end=ansiprint.end(), blue=ansiprint.blue(), stype=status_data['type'], primary=status_data['primary_node']))
|
click.echo('{bold}Ceph cluster {stype} (primary node {end}{blue}{primary}{end}{bold}){end}\n'.format(bold=ansiprint.bold(), end=ansiprint.end(), blue=ansiprint.blue(), stype=status_data['type'], primary=status_data['primary_node']))
|
||||||
click.echo(status_data['ceph_data'])
|
click.echo(status_data['ceph_data'])
|
||||||
|
@ -211,7 +211,7 @@ def add_osd(zk_conn, node, device, weight):
|
||||||
return False, 'ERROR: Block device "{}" on node "{}" is used by OSD "{}"'.format(device, node, block_osd)
|
return False, 'ERROR: Block device "{}" on node "{}" is used by OSD "{}"'.format(device, node, block_osd)
|
||||||
|
|
||||||
# Tell the cluster to create a new OSD for the host
|
# Tell the cluster to create a new OSD for the host
|
||||||
add_osd_string = 'osd_add {},{},{}'.format(node, device, weight)
|
add_osd_string = 'osd_add {},{},{}'.format(node, device, weight)
|
||||||
zkhandler.writedata(zk_conn, {'/ceph/cmd': add_osd_string})
|
zkhandler.writedata(zk_conn, {'/ceph/cmd': add_osd_string})
|
||||||
# Wait 1/2 second for the cluster to get the message and start working
|
# Wait 1/2 second for the cluster to get the message and start working
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
@ -640,7 +640,7 @@ Wr: {osd_wrops: <{osd_wrops_length}} \
|
||||||
osd_rddata=osd_information['stats']['rd_data']
|
osd_rddata=osd_information['stats']['rd_data']
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo('\n'.join(sorted(osd_list_output)))
|
click.echo('\n'.join(sorted(osd_list_output)))
|
||||||
|
|
||||||
|
|
||||||
|
@ -660,7 +660,7 @@ def getPoolInformation(zk_conn, pool):
|
||||||
|
|
||||||
def add_pool(zk_conn, name, pgs):
|
def add_pool(zk_conn, name, pgs):
|
||||||
# Tell the cluster to create a new pool
|
# Tell the cluster to create a new pool
|
||||||
add_pool_string = 'pool_add {},{}'.format(name, pgs)
|
add_pool_string = 'pool_add {},{}'.format(name, pgs)
|
||||||
zkhandler.writedata(zk_conn, {'/ceph/cmd': add_pool_string})
|
zkhandler.writedata(zk_conn, {'/ceph/cmd': add_pool_string})
|
||||||
# Wait 1/2 second for the cluster to get the message and start working
|
# Wait 1/2 second for the cluster to get the message and start working
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
@ -692,7 +692,7 @@ def remove_pool(zk_conn, name):
|
||||||
return False, 'ERROR: No pool with name "{}" is present in the cluster.'.format(name)
|
return False, 'ERROR: No pool with name "{}" is present in the cluster.'.format(name)
|
||||||
|
|
||||||
# Tell the cluster to create a new pool
|
# Tell the cluster to create a new pool
|
||||||
remove_pool_string = 'pool_remove {}'.format(name)
|
remove_pool_string = 'pool_remove {}'.format(name)
|
||||||
zkhandler.writedata(zk_conn, {'/ceph/cmd': remove_pool_string})
|
zkhandler.writedata(zk_conn, {'/ceph/cmd': remove_pool_string})
|
||||||
# Wait 1/2 second for the cluster to get the message and start working
|
# Wait 1/2 second for the cluster to get the message and start working
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
@ -902,7 +902,7 @@ Wr: {pool_write_ops: <{pool_write_ops_length}} \
|
||||||
pool_read_data=pool_information['stats']['read_bytes']
|
pool_read_data=pool_information['stats']['read_bytes']
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo('\n'.join(sorted(pool_list_output)))
|
click.echo('\n'.join(sorted(pool_list_output)))
|
||||||
|
|
||||||
|
|
||||||
|
@ -1030,7 +1030,7 @@ def remove_volume(zk_conn, pool, name):
|
||||||
return False, 'ERROR: No volume with name "{}" is present in pool {}.'.format(name, pool)
|
return False, 'ERROR: No volume with name "{}" is present in pool {}.'.format(name, pool)
|
||||||
|
|
||||||
# Tell the cluster to create a new volume
|
# Tell the cluster to create a new volume
|
||||||
remove_volume_string = 'volume_remove {},{}'.format(pool, name)
|
remove_volume_string = 'volume_remove {},{}'.format(pool, name)
|
||||||
zkhandler.writedata(zk_conn, {'/ceph/cmd': remove_volume_string})
|
zkhandler.writedata(zk_conn, {'/ceph/cmd': remove_volume_string})
|
||||||
# Wait 1/2 second for the cluster to get the message and start working
|
# Wait 1/2 second for the cluster to get the message and start working
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
@ -1070,7 +1070,7 @@ def get_list_volume(zk_conn, pool, limit, is_fuzzy=True):
|
||||||
limit = '.*' + limit
|
limit = '.*' + limit
|
||||||
if not re.match('.*\$', limit):
|
if not re.match('.*\$', limit):
|
||||||
limit = limit + '.*'
|
limit = limit + '.*'
|
||||||
|
|
||||||
for volume in full_volume_list:
|
for volume in full_volume_list:
|
||||||
pool_name, volume_name = volume.split('/')
|
pool_name, volume_name = volume.split('/')
|
||||||
if limit:
|
if limit:
|
||||||
|
@ -1188,7 +1188,7 @@ def format_list_volume(volume_list):
|
||||||
volume_features=','.join(volume_information['stats']['features']),
|
volume_features=','.join(volume_information['stats']['features']),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo('\n'.join(sorted(volume_list_output)))
|
click.echo('\n'.join(sorted(volume_list_output)))
|
||||||
|
|
||||||
|
|
||||||
|
@ -1215,7 +1215,7 @@ def getCephSnapshots(zk_conn, pool, volume):
|
||||||
|
|
||||||
def add_snapshot(zk_conn, pool, volume, name):
|
def add_snapshot(zk_conn, pool, volume, name):
|
||||||
# Tell the cluster to create a new snapshot
|
# Tell the cluster to create a new snapshot
|
||||||
add_snapshot_string = 'snapshot_add {},{},{}'.format(pool, volume, name)
|
add_snapshot_string = 'snapshot_add {},{},{}'.format(pool, volume, name)
|
||||||
zkhandler.writedata(zk_conn, {'/ceph/cmd': add_snapshot_string})
|
zkhandler.writedata(zk_conn, {'/ceph/cmd': add_snapshot_string})
|
||||||
# Wait 1/2 second for the cluster to get the message and start working
|
# Wait 1/2 second for the cluster to get the message and start working
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
@ -1247,7 +1247,7 @@ def remove_snapshot(zk_conn, pool, volume, name):
|
||||||
return False, 'ERROR: No snapshot with name "{}" is present of volume {} on pool {}.'.format(name, volume, pool)
|
return False, 'ERROR: No snapshot with name "{}" is present of volume {} on pool {}.'.format(name, volume, pool)
|
||||||
|
|
||||||
# Tell the cluster to create a new snapshot
|
# Tell the cluster to create a new snapshot
|
||||||
remove_snapshot_string = 'snapshot_remove {},{},{}'.format(pool, volume, name)
|
remove_snapshot_string = 'snapshot_remove {},{},{}'.format(pool, volume, name)
|
||||||
zkhandler.writedata(zk_conn, {'/ceph/cmd': remove_snapshot_string})
|
zkhandler.writedata(zk_conn, {'/ceph/cmd': remove_snapshot_string})
|
||||||
# Wait 1/2 second for the cluster to get the message and start working
|
# Wait 1/2 second for the cluster to get the message and start working
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
@ -1366,5 +1366,5 @@ def format_list_snapshot(snapshot_list):
|
||||||
snapshot_pool=snapshot_pool,
|
snapshot_pool=snapshot_pool,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo('\n'.join(sorted(snapshot_list_output)))
|
click.echo('\n'.join(sorted(snapshot_list_output)))
|
||||||
|
|
Loading…
Reference in New Issue