pb-2003: added ordered way of classifying the driver in GetPVDriver api
GetPVDriver is used in the resource restore path and we try to
avoid CSI pvc applied again. Since ordered list is not used in
this function, some it ended up in kdmp driver and ended in
partial success.
@@ -340,7 +340,11 @@ func GetPVCDriver(coreOps core.Ops,
// GetPVDriver gets the driver associated with a PV. Returns ErrNotFound if the PV is
// not owned by any available driver
func GetPVDriver(pv *v1.PersistentVolume) (string, error) {
- for driverName, d := range volDrivers {
+ for _, driverName := range orderedListOfDrivers {
+ d, ok := volDrivers[driverName]
+ if !ok {
+ continue
+ }
if d.OwnsPV(pv) {
return driverName, nil
}
