Add OSD add and OSD remove commands
This commit is contained in:
parent
3025772e6d
commit
7f18c99172
|
@ -938,6 +938,41 @@ def ceph_osd():
|
|||
"""
|
||||
pass
|
||||
|
||||
###############################################################################
|
||||
# pvc ceph osd add
|
||||
###############################################################################
|
||||
@click.command(name='add', short_help='Add new OSD.')
|
||||
@click.argument(
|
||||
'node'
|
||||
)
|
||||
@click.argument(
|
||||
'device'
|
||||
)
|
||||
def ceph_osd_add(node, device):
|
||||
"""
|
||||
Add a new Ceph OSD on node NODE with block device DEVICE to the cluster.
|
||||
"""
|
||||
|
||||
zk_conn = pvc_common.startZKConnection(zk_host)
|
||||
retcode, retmsg = pvc_ceph.add_osd(zk_conn, node, device)
|
||||
cleanup(retcode, retmsg, zk_conn)
|
||||
|
||||
###############################################################################
|
||||
# pvc ceph osd remove
|
||||
###############################################################################
|
||||
@click.command(name='remove', short_help='Remove OSD.')
|
||||
@click.argument(
|
||||
'osdid'
|
||||
)
|
||||
def ceph_osd_remove(node, device):
|
||||
"""
|
||||
Remove a Ceph OSD with ID OSDID from the cluster.
|
||||
"""
|
||||
|
||||
zk_conn = pvc_common.startZKConnection(zk_host)
|
||||
retcode, retmsg = pvc_ceph.remove_osd(zk_conn, osdid)
|
||||
cleanup(retcode, retmsg, zk_conn)
|
||||
|
||||
###############################################################################
|
||||
# pvc ceph pool
|
||||
###############################################################################
|
||||
|
@ -1077,7 +1112,7 @@ net_acl.add_command(net_acl_add)
|
|||
net_acl.add_command(net_acl_remove)
|
||||
net_acl.add_command(net_acl_list)
|
||||
|
||||
#ceph_osd.add_command(ceph_osd_add)
|
||||
ceph_osd.add_command(ceph_osd_add)
|
||||
#ceph_osd.add_command(ceph_osd_remove)
|
||||
#ceph_osd.add_command(ceph_osd_in)
|
||||
#ceph_osd.add_command(ceph_osd_out)
|
||||
|
|
|
@ -53,3 +53,19 @@ def get_status(zk_conn):
|
|||
click.echo(status_data)
|
||||
click.echo('')
|
||||
return True, ''
|
||||
|
||||
def add_osd(zk_conn, node, device):
|
||||
if not common.verifyNode(zk_conn, node):
|
||||
return False, 'ERROR: No node named "{}" is present in the cluster.'.format(node)
|
||||
|
||||
# Tell the cluster to create a new OSD for the host
|
||||
new_osd_string = 'new {},{}'.format(node, device)
|
||||
zkhandler.writedata(zk_conn, {'/ceph/osd_cmd': new_osd_string})
|
||||
click.echo('Created new OSD with block device {} on node {}.'.format(device, node))
|
||||
return True, ''
|
||||
|
||||
def remove_osd(zk_conn, osd_id):
|
||||
remove_osd_string = 'remove {}'.format(osd_id)
|
||||
zkhandler.writedata(zk_conn, {'/ceph/osd_cmd': remove_osd_string})
|
||||
click.echo('Remove OSD {} from the cluster.'.format(osd_id))
|
||||
return True, ''
|
||||
|
|
Loading…
Reference in New Issue