Fix skip_zap_flag anomaly and add crush rm

This commit is contained in:
Joshua Boniface 2023-11-03 02:34:01 -04:00
parent 20497cf89d
commit 94d8d2cf75
1 changed files with 22 additions and 11 deletions

View File

@ -860,17 +860,28 @@ class CephOSDInstance(object):
else: else:
raise Exception raise Exception
if not skip_zap_flag: retcode, stdout, stderr = common.run_os_command(
# 7. Remove the DB device f"ceph osd crush rm osd.{osd_id}"
if zkhandler.exists(("osd.db_device", osd_id)): )
db_device = zkhandler.read(("osd.db_device", osd_id)) if retcode:
logger.out( print("ceph osd crush rm")
'Removing OSD DB logical volume "{}"'.format(db_device), print(stdout)
state="i", print(stderr)
) if force_flag:
retcode, stdout, stderr = common.run_os_command( logger.out("Ignoring error due to force flag", state="i")
"lvremove --yes --force {}".format(db_device) else:
) raise Exception
# 7. Remove the DB device
if zkhandler.exists(("osd.db_device", osd_id)):
db_device = zkhandler.read(("osd.db_device", osd_id))
logger.out(
'Removing OSD DB logical volume "{}"'.format(db_device),
state="i",
)
retcode, stdout, stderr = common.run_os_command(
"lvremove --yes --force {}".format(db_device)
)
# 8. Delete OSD from ZK # 8. Delete OSD from ZK
logger.out("Deleting OSD {} from Zookeeper".format(osd_id), state="i") logger.out("Deleting OSD {} from Zookeeper".format(osd_id), state="i")