mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
util: addresed few todo
this commit replaces string comparsion with error code at few places Signed-off-by: Riya Singhal <rsinghal@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
4ccb299fd5
commit
4b5cdd5316
@ -2143,15 +2143,13 @@ func (rv *rbdVolume) setAllMetadata(parameters map[string]string) error {
|
||||
func (rv *rbdVolume) unsetAllMetadata(keys []string) error {
|
||||
for _, key := range keys {
|
||||
err := rv.RemoveMetadata(key)
|
||||
// TODO: replace string comparison with errno.
|
||||
if err != nil && !strings.Contains(err.Error(), "No such file or directory") {
|
||||
if err != nil && !errors.Is(err, librbd.ErrNotExist) {
|
||||
return fmt.Errorf("failed to unset metadata key %q on %q: %w", key, rv, err)
|
||||
}
|
||||
}
|
||||
|
||||
err := rv.RemoveMetadata(clusterNameKey)
|
||||
// TODO: replace string comparison with errno.
|
||||
if err != nil && !strings.Contains(err.Error(), "No such file or directory") {
|
||||
if err != nil && !errors.Is(err, librbd.ErrNotExist) {
|
||||
return fmt.Errorf("failed to unset metadata key %q on %q: %w", clusterNameKey, rv, err)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user