mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Call NodeUnpublish after NodePublish timeout
When NodePublish times out and user deletes corresponding pod, the driver may continue publishing the volume. In order to "cancel" this operation, Kubernetes must issue NodeUnpublish and wait until it finishes. Therefore, NodeUnpublish should be called even if the target directory (created by the driver) does not exist yet.
This commit is contained in:
parent
86a5bd98b6
commit
f6fc73573c
@ -503,19 +503,8 @@ func (m *csiBlockMapper) UnmapPodDevice() error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), csiTimeout)
|
||||
defer cancel()
|
||||
|
||||
// Call NodeUnpublishVolume
|
||||
if _, err := os.Stat(publishPath); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
klog.V(4).Infof(log("blockMapper.UnmapPodDevice publishPath(%s) has already been deleted, skip calling NodeUnpublishVolume", publishPath))
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
err := m.unpublishVolumeForBlock(ctx, csiClient, publishPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
// Call NodeUnpublishVolume.
|
||||
// Even if publishPath does not exist - previous NodePublish may have timed out
|
||||
// and Kubernetes makes sure that the operation is finished.
|
||||
return m.unpublishVolumeForBlock(ctx, csiClient, publishPath)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user