journal: do not return errors from remove omap func if omap missing

The previous function used to remove omap keys apparently did not
return errors when removing omap keys from a missing omap (oid).
Mimic that behavior when using the api.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2020-06-08 17:14:47 -04:00 committed by mergify[bot]
parent d32cef5b9f
commit 09e1c856d0

View File

@ -93,16 +93,25 @@ func removeMapKeys(
} }
err = ioctx.RmOmapKeys(oid, keys) err = ioctx.RmOmapKeys(oid, keys)
if err != nil { switch err {
case nil:
case rados.ErrNotFound:
// the previous implementation of removing omap keys (via the cli)
// treated failure to find the omap as a non-error. Do so here to
// mimic the previous behavior.
klog.V(4).Infof(
util.Log(ctx, "when removing omap keys, omap not found (pool=%q, namespace=%q, name=%q): %+v"),
poolName, namespace, oid, keys)
default:
klog.Errorf( klog.Errorf(
util.Log(ctx, "failed removing omap keys (pool=%q, namespace=%q, name=%q): %v"), util.Log(ctx, "failed removing omap keys (pool=%q, namespace=%q, name=%q): %v"),
poolName, namespace, oid, err) poolName, namespace, oid, err)
} else { return err
klog.V(4).Infof(
util.Log(ctx, "removed omap keys (pool=%q, namespace=%q, name=%q): %+v"),
poolName, namespace, oid, keys)
} }
return err klog.V(4).Infof(
util.Log(ctx, "removed omap keys (pool=%q, namespace=%q, name=%q): %+v"),
poolName, namespace, oid, keys)
return nil
} }
func setOMapKeys( func setOMapKeys(