Fix a few more bugs
This commit is contained in:
parent
97a3dafa3b
commit
3dd56c55c0
|
@ -1443,7 +1443,7 @@ def ceph_volume_snapshot_remove(pool, volume, name):
|
||||||
Remove a Ceph RBD volume with name NAME from pool POOL.
|
Remove a Ceph RBD volume with name NAME from pool POOL.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
click.echo('DANGER: This will completely remove volume {} from pool {} and all data contained in it.'.format(name, pool))
|
click.echo('DANGER: This will completely remove snapshot {} from volume {}/{} and all data contained in it.'.format(name, pool, volume))
|
||||||
choice = input('Are you sure you want to do this? (y/N) ')
|
choice = input('Are you sure you want to do this? (y/N) ')
|
||||||
if choice == 'y' or choice == 'Y':
|
if choice == 'y' or choice == 'Y':
|
||||||
zk_conn = pvc_common.startZKConnection(zk_host)
|
zk_conn = pvc_common.startZKConnection(zk_host)
|
||||||
|
|
|
@ -729,14 +729,16 @@ def getCephSnapshots(zk_conn, pool, volume):
|
||||||
snapshot_list = list()
|
snapshot_list = list()
|
||||||
volume_list = list()
|
volume_list = list()
|
||||||
|
|
||||||
if volume == 'all':
|
|
||||||
volume_list = getCephVolumes(zk_conn, pool)
|
volume_list = getCephVolumes(zk_conn, pool)
|
||||||
else:
|
if volume != 'all':
|
||||||
volume_list = [ '{}/{}'.format(pool, volume) ]
|
for volume_entry in volume_list:
|
||||||
|
volume_pool, volume_name = volume_entry.split('/')
|
||||||
|
if volume_name == volume:
|
||||||
|
volume_list = [ '{}/{}'.format(volume_pool, volume_name) ]
|
||||||
|
|
||||||
for volume_name in volume_list:
|
for volume_entry in volume_list:
|
||||||
for snapshot_name in zkhandler.listchildren(zk_conn, '/ceph/snapshots/{}'.format(volume_name)):
|
for snapshot_name in zkhandler.listchildren(zk_conn, '/ceph/snapshots/{}'.format(volume_entry)):
|
||||||
snapshot_list.append('{}@{}'.format(volume_name, snapshot_name))
|
snapshot_list.append('{}@{}'.format(volume_entry, snapshot_name))
|
||||||
|
|
||||||
return snapshot_list
|
return snapshot_list
|
||||||
|
|
||||||
|
@ -1161,6 +1163,9 @@ def remove_volume(zk_conn, pool, name):
|
||||||
|
|
||||||
def get_list_volume(zk_conn, pool, limit):
|
def get_list_volume(zk_conn, pool, limit):
|
||||||
volume_list = []
|
volume_list = []
|
||||||
|
if pool != 'all' and not verifyPool(zk_conn, name):
|
||||||
|
return False, 'ERROR: No pool with name "{}" is present in the cluster.'.format(name)
|
||||||
|
|
||||||
full_volume_list = getCephVolumes(zk_conn, pool)
|
full_volume_list = getCephVolumes(zk_conn, pool)
|
||||||
|
|
||||||
if limit:
|
if limit:
|
||||||
|
@ -1252,6 +1257,12 @@ def remove_snapshot(zk_conn, pool, volume, name):
|
||||||
|
|
||||||
def get_list_snapshot(zk_conn, pool, volume, limit):
|
def get_list_snapshot(zk_conn, pool, volume, limit):
|
||||||
snapshot_list = []
|
snapshot_list = []
|
||||||
|
if pool != 'all' and not verifyPool(zk_conn, pool):
|
||||||
|
return False, 'ERROR: No pool with name "{}" is present in the cluster.'.format(pool)
|
||||||
|
|
||||||
|
if volume != 'all' and not verifyPool(zk_conn, volume):
|
||||||
|
return False, 'ERROR: No volume with name "{}" is present in the cluster.'.format(volume)
|
||||||
|
|
||||||
full_snapshot_list = getCephSnapshots(zk_conn, pool, volume)
|
full_snapshot_list = getCephSnapshots(zk_conn, pool, volume)
|
||||||
|
|
||||||
if limit:
|
if limit:
|
||||||
|
|
Loading…
Reference in New Issue