From 77fed9d2b7bef754b6d5b40c97b0a820d3760fd4 Mon Sep 17 00:00:00 2001 From: carlory Date: Tue, 30 Jan 2024 17:29:54 +0800 Subject: [PATCH] fix GenerateUnmapVolumeFunc missing globalUnmapPath when kubelet tries to clean up all volumes that failed reconstruction. --- pkg/volume/util/operationexecutor/operation_generator.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/volume/util/operationexecutor/operation_generator.go b/pkg/volume/util/operationexecutor/operation_generator.go index 22917267510..aba0a4f64cb 100644 --- a/pkg/volume/util/operationexecutor/operation_generator.go +++ b/pkg/volume/util/operationexecutor/operation_generator.go @@ -1295,7 +1295,12 @@ func (og *operationGenerator) GenerateUnmapVolumeFunc( // pods/{podUid}/volumeDevices/{escapeQualifiedPluginName}/{volumeName} podDeviceUnmapPath, volName := blockVolumeUnmapper.GetPodDeviceMapPath() // plugins/kubernetes.io/{PluginName}/volumeDevices/{volumePluginDependentPath}/{podUID} - globalUnmapPath := volumeToUnmount.DeviceMountPath + globalUnmapPath, err := blockVolumeUnmapper.GetGlobalMapPath(volumeToUnmount.VolumeSpec) + if err != nil { + // On failure, return error. Caller will log and retry. + eventErr, detailedErr := volumeToUnmount.GenerateError("UnmapVolume.GetGlobalMapPath failed", err) + return volumetypes.NewOperationContext(eventErr, detailedErr, migrated) + } // Mark the device as uncertain to make sure kubelet calls UnmapDevice again in all the "return err" // cases below. The volume is marked as fully un-mapped at the end of this function, when everything