ceph: during object store deletion return success if not found

If the object store is not found during deletion of the object store CR,
proceed with the deletion instead of blocking and re-queueing the
deletion reconcile in an endless loop. This was causing instability
in the integration tests.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
This commit is contained in:
Travis Nielsen
2021-01-13 15:44:28 -07:00
parent 148d98ee42
commit ea29665a8a
+6 -1
View File
@@ -157,6 +157,10 @@ func deleteSingleSiteRealmAndPools(objContext *Context, spec cephv1.ObjectStoreS
if err != nil {
return errors.Wrap(err, "failed to detect object stores during deletion")
}
if len(stores) == 0 {
logger.Infof("did not find object store %q, nothing to delete", objContext.Name)
return nil
}
logger.Infof("Found stores %v when deleting store %s", stores, objContext.Name)
err = deleteRealm(objContext)
@@ -560,7 +564,8 @@ func DecodeZoneGroupConfig(data string) (zoneGroupType, error) {
func getObjectStores(context *Context) ([]string, error) {
output, err := RunAdminCommandNoMultisite(context, "realm", "list")
if err != nil {
if strings.Index(err.Error(), "exit status 2") != 0 {
// exit status 2 indicates the object store does not exist, so return nothing
if strings.Index(err.Error(), "exit status 2") == 0 {
return []string{}, nil
}
return nil, err