Clean up handling of OSD dump command
This commit is contained in:
parent
190623bdd9
commit
040ca33683
|
@ -213,16 +213,19 @@ def remove_osd(zk_conn, logger, osd_id, osd_obj):
|
||||||
logger.out('Flushing OSD disk with ID {}'.format(osd_id), state='i')
|
logger.out('Flushing OSD disk with ID {}'.format(osd_id), state='i')
|
||||||
osd_string = str()
|
osd_string = str()
|
||||||
while True:
|
while True:
|
||||||
retcode, stdout, stderr = common.run_os_command('ceph pg dump osds --format json')
|
try:
|
||||||
dump_string = json.loads(stdout)
|
retcode, stdout, stderr = common.run_os_command('ceph pg dump osds --format json')
|
||||||
for osd in dump_string:
|
dump_string = json.loads(stdout)
|
||||||
if str(osd['osd']) == osd_id:
|
for osd in dump_string:
|
||||||
osd_string = osd
|
if str(osd['osd']) == osd_id:
|
||||||
num_pgs = osd_string['num_pgs']
|
osd_string = osd
|
||||||
if num_pgs > 0:
|
num_pgs = osd_string['num_pgs']
|
||||||
time.sleep(5)
|
if num_pgs > 0:
|
||||||
else:
|
time.sleep(5)
|
||||||
break
|
else:
|
||||||
|
raise
|
||||||
|
except:
|
||||||
|
break
|
||||||
|
|
||||||
# 3. Stop the OSD process and wait for it to be terminated
|
# 3. Stop the OSD process and wait for it to be terminated
|
||||||
logger.out('Stopping OSD disk with ID {}'.format(osd_id), state='i')
|
logger.out('Stopping OSD disk with ID {}'.format(osd_id), state='i')
|
||||||
|
|
Loading…
Reference in New Issue