Merge "Delete ceph stor when removing controller"

This commit is contained in:
Zuul 2021-05-20 21:15:39 +00:00 committed by Gerrit Code Review
commit fcb6d5f35f
2 changed files with 7 additions and 5 deletions

View File

@ -2491,12 +2491,14 @@ class HostController(rest.RestController):
ceph_mons[0].uuid, {'device_path': None} ceph_mons[0].uuid, {'device_path': None}
) )
remove_from_cluster = True if ihost.invprovision == constants.PROVISIONED else False
# Delete the stor entries associated with this host # Delete the stor entries associated with this host
istors = pecan.request.dbapi.istor_get_by_ihost(ihost['uuid']) istors = pecan.request.dbapi.istor_get_by_ihost(ihost['uuid'])
for stor in istors: for stor in istors:
try: try:
self.istors.delete_stor(stor.uuid) self.istors.delete_stor(stor.uuid, remove_from_cluster)
except Exception as e: except Exception as e:
# Do not destroy the ihost if the stor cannot be deleted. # Do not destroy the ihost if the stor cannot be deleted.
LOG.exception(e) LOG.exception(e)

View File

@ -497,7 +497,7 @@ class StorageController(rest.RestController):
constants.STOR_FUNCTION_OSD, constants.STOR_FUNCTION_OSD,
constants.SB_STATE_CONFIGURING_ON_UNLOCK)) constants.SB_STATE_CONFIGURING_ON_UNLOCK))
def delete_stor(self, stor_uuid): def delete_stor(self, stor_uuid, remove_from_cluster=False):
"""Delete a stor""" """Delete a stor"""
stor = objects.storage.get_by_uuid(pecan.request.context, stor_uuid) stor = objects.storage.get_by_uuid(pecan.request.context, stor_uuid)
@ -505,9 +505,9 @@ class StorageController(rest.RestController):
try: try:
# The conductor will handle removing the stor, not all functions # The conductor will handle removing the stor, not all functions
# need special handling # need special handling
# if stor.function == constants.STOR_FUNCTION_OSD: if stor.function == constants.STOR_FUNCTION_OSD and remove_from_cluster:
# pecan.request.rpcapi.unconfigure_osd_istor(pecan.request.context, pecan.request.rpcapi.unconfigure_osd_istor(pecan.request.context,
# stor) stor)
if stor.function == constants.STOR_FUNCTION_JOURNAL: if stor.function == constants.STOR_FUNCTION_JOURNAL:
pecan.request.dbapi.istor_disable_journal(stor_uuid) pecan.request.dbapi.istor_disable_journal(stor_uuid)
# Now remove the stor from DB # Now remove the stor from DB