From 94d8d2cf7520529675f77afe227ef8619ac25f76 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 3 Nov 2023 02:34:01 -0400 Subject: [PATCH] Fix skip_zap_flag anomaly and add crush rm --- node-daemon/pvcnoded/objects/CephInstance.py | 33 +++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/node-daemon/pvcnoded/objects/CephInstance.py b/node-daemon/pvcnoded/objects/CephInstance.py index 2c095d35..b7572639 100644 --- a/node-daemon/pvcnoded/objects/CephInstance.py +++ b/node-daemon/pvcnoded/objects/CephInstance.py @@ -860,17 +860,28 @@ class CephOSDInstance(object): else: raise Exception - if not skip_zap_flag: - # 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) - ) + retcode, stdout, stderr = common.run_os_command( + f"ceph osd crush rm osd.{osd_id}" + ) + if retcode: + print("ceph osd crush rm") + print(stdout) + print(stderr) + if force_flag: + logger.out("Ignoring error due to force flag", state="i") + 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 logger.out("Deleting OSD {} from Zookeeper".format(osd_id), state="i")