mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 12:07:47 +00:00
Use a separate function for checking if device was reconstructed
This commit is contained in:
parent
56dd5ab10f
commit
e706b6ba14
@ -404,7 +404,7 @@ func (asw *actualStateOfWorld) IsVolumeReconstructed(volumeName v1.UniqueVolumeN
|
||||
volumeState := asw.GetVolumeMountState(volumeName, podName)
|
||||
|
||||
// only uncertain volumes are reconstructed
|
||||
if volumeState != operationexecutor.VolumeMountUncertain && podName != operationexecutor.EmptyUniquePodName {
|
||||
if volumeState != operationexecutor.VolumeMountUncertain {
|
||||
return false
|
||||
}
|
||||
|
||||
@ -414,14 +414,17 @@ func (asw *actualStateOfWorld) IsVolumeReconstructed(volumeName v1.UniqueVolumeN
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
|
||||
if podName == operationexecutor.EmptyUniquePodName {
|
||||
return true
|
||||
}
|
||||
_, foundPod := podMap[podName]
|
||||
return foundPod
|
||||
}
|
||||
|
||||
func (asw *actualStateOfWorld) IsVolumeDeviceReconstructed(volumeName v1.UniqueVolumeName) bool {
|
||||
asw.RLock()
|
||||
defer asw.RUnlock()
|
||||
_, ok := asw.foundDuringReconstruction[volumeName]
|
||||
return ok
|
||||
}
|
||||
|
||||
func (asw *actualStateOfWorld) CheckAndMarkVolumeAsUncertainViaReconstruction(opts operationexecutor.MarkVolumeOpts) (bool, error) {
|
||||
asw.Lock()
|
||||
defer asw.Unlock()
|
||||
|
@ -39,11 +39,6 @@ import (
|
||||
volumetypes "k8s.io/kubernetes/pkg/volume/util/types"
|
||||
)
|
||||
|
||||
const (
|
||||
// EmptyUniquePodName is a UniquePodName for empty string.
|
||||
EmptyUniquePodName volumetypes.UniquePodName = volumetypes.UniquePodName("")
|
||||
)
|
||||
|
||||
// OperationExecutor defines a set of operations for attaching, detaching,
|
||||
// mounting, or unmounting a volume that are executed with a NewNestedPendingOperations which
|
||||
// prevents more than one operation from being triggered on the same volume.
|
||||
@ -234,6 +229,10 @@ type ActualStateOfWorldMounterUpdater interface {
|
||||
// IsVolumeReconstructed returns true if volume currently added to actual state of the world
|
||||
// was found during reconstruction.
|
||||
IsVolumeReconstructed(volumeName v1.UniqueVolumeName, podName volumetypes.UniquePodName) bool
|
||||
|
||||
// IsVolumeDeviceReconstructed returns true if volume device identified by volumeName has been
|
||||
// found during reconstruction.
|
||||
IsVolumeDeviceReconstructed(volumeName v1.UniqueVolumeName) bool
|
||||
}
|
||||
|
||||
// ActualStateOfWorldAttacherUpdater defines a set of operations updating the
|
||||
|
@ -781,8 +781,8 @@ func (og *operationGenerator) markDeviceErrorState(volumeToMount VolumeToMount,
|
||||
if volumetypes.IsOperationFinishedError(mountError) &&
|
||||
actualStateOfWorld.GetDeviceMountState(volumeToMount.VolumeName) == DeviceMountUncertain {
|
||||
|
||||
if actualStateOfWorld.IsVolumeReconstructed(volumeToMount.VolumeName, EmptyUniquePodName) {
|
||||
klog.V(2).InfoS("MountVolume.markDeviceErrorState uncertainDeviceFix leaving volume uncertain", "volumeName", volumeToMount.VolumeName)
|
||||
if actualStateOfWorld.IsVolumeDeviceReconstructed(volumeToMount.VolumeName) {
|
||||
klog.V(2).InfoS("MountVolume.markDeviceErrorState leaving volume uncertain", "volumeName", volumeToMount.VolumeName)
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user