dell / csi-baremetal

Bare-metal CSI Driver
Apache License 2.0
72 stars 33 forks source link

Fix issue that GetVolumePath return a nil instead of error when can't get partition uuid #1078

Closed libzhang closed 8 months ago

libzhang commented 8 months ago

Purpose

Resolves #

This is to resolve that an issue that GetVolumePath always return a nil when met error in getting partition stage. we should return error if any error met in getting partition stage.

In RPC NodeStageVolume request, below code should return an err if GetVolumePath failed, this will then cause NodeStageVolume failure. then Kubelet should retry this rpc again and again. This give the chance that driveCR updated success.

partition, err := s.getProvisionerForVolume(&volumeCR.Spec).GetVolumePath(&volumeCR.Spec)

Changes: this change fix an issue that a global err is defined, but we have another local err variable defined in a {} scope, so finally the global err always is nil.
Here we remove the retry for loop and always use the global err variable, as currently in search partition command, we already have a retry. so the retry here is not needed any more.

PR checklist

Testing

Provide test details

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (f45d675) 72.76% compared to head (6302fdb) 72.79%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1078 +/- ## ========================================== + Coverage 72.76% 72.79% +0.02% ========================================== Files 63 63 Lines 8949 8946 -3 ========================================== Hits 6512 6512 + Misses 2147 2145 -2 + Partials 290 289 -1 ``` | [Flag](https://app.codecov.io/gh/dell/csi-baremetal/pull/1078/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/dell/csi-baremetal/pull/1078/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell) | `72.79% <100.00%> (+0.02%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.