mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 16:06:51 +00:00
Merge pull request #71276 from jingxu97/Oct/uncertain
Handle failed attach operation leave uncertain volume attach state
This commit is contained in:
@@ -192,6 +192,12 @@ type ActualStateOfWorldAttacherUpdater interface {
|
||||
// volumes. See issue 29695.
|
||||
MarkVolumeAsAttached(volumeName v1.UniqueVolumeName, volumeSpec *volume.Spec, nodeName types.NodeName, devicePath string) error
|
||||
|
||||
// Marks the specified volume as *possibly* attached to the specified node.
|
||||
// If an attach operation fails, the attach/detach controller does not know for certain if the volume is attached or not.
|
||||
// If the volume name is supplied, that volume name will be used. If not, the
|
||||
// volume name is computed using the result from querying the plugin.
|
||||
MarkVolumeAsUncertain(volumeName v1.UniqueVolumeName, volumeSpec *volume.Spec, nodeName types.NodeName) error
|
||||
|
||||
// Marks the specified volume as detached from the specified node
|
||||
MarkVolumeAsDetached(volumeName v1.UniqueVolumeName, nodeName types.NodeName)
|
||||
|
||||
|
||||
@@ -327,6 +327,12 @@ func (og *operationGenerator) GenerateAttachVolumeFunc(
|
||||
klog.Errorf("AttachVolume.MarkVolumeAsAttached failed to fix dangling volume error for volume %q with %s", volumeToAttach.VolumeName, addErr)
|
||||
}
|
||||
|
||||
} else {
|
||||
addErr := actualStateOfWorld.MarkVolumeAsUncertain(
|
||||
v1.UniqueVolumeName(""), volumeToAttach.VolumeSpec, volumeToAttach.NodeName)
|
||||
if addErr != nil {
|
||||
klog.Errorf("AttachVolume.MarkVolumeAsUncertain fail to add the volume %q to actual state with %s", volumeToAttach.VolumeName, addErr)
|
||||
}
|
||||
}
|
||||
// On failure, return error. Caller will log and retry.
|
||||
return volumeToAttach.GenerateError("AttachVolume.Attach failed", attachErr)
|
||||
|
||||
Reference in New Issue
Block a user