mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 15:58:37 +00:00
Remove unused WaitForDetach from Detacher interface and plugins
This has been unused since 542f2dc7
, and relies on deviceName, which
can no longer be relied upon (see issue #33128).
This needs to be removed now, as part of #33128, as the code can't be
updated to attempt device detection and fallback through to the Cinder
provided deviceName, as detection "fails" when the device is gone, and
if cinder has reported a deviceName that another volume has used in
relaity, then this will block forever (or until the other, unreleated,
volume has been detached)
This commit is contained in:
parent
3eae250c58
commit
ccb8d53a39
@ -244,27 +244,6 @@ func (detacher *awsElasticBlockStoreDetacher) Detach(deviceMountPath string, nod
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (detacher *awsElasticBlockStoreDetacher) WaitForDetach(devicePath string, timeout time.Duration) error {
|
|
||||||
ticker := time.NewTicker(checkSleepDuration)
|
|
||||||
defer ticker.Stop()
|
|
||||||
timer := time.NewTimer(timeout)
|
|
||||||
defer timer.Stop()
|
|
||||||
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-ticker.C:
|
|
||||||
glog.V(5).Infof("Checking device %q is detached.", devicePath)
|
|
||||||
if pathExists, err := volumeutil.PathExists(devicePath); err != nil {
|
|
||||||
return fmt.Errorf("Error checking if device path exists: %v", err)
|
|
||||||
} else if !pathExists {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
case <-timer.C:
|
|
||||||
return fmt.Errorf("Timeout reached; PD Device %v is still attached", devicePath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (detacher *awsElasticBlockStoreDetacher) UnmountDevice(deviceMountPath string) error {
|
func (detacher *awsElasticBlockStoreDetacher) UnmountDevice(deviceMountPath string) error {
|
||||||
return volumeutil.UnmountPath(deviceMountPath, detacher.mounter)
|
return volumeutil.UnmountPath(deviceMountPath, detacher.mounter)
|
||||||
}
|
}
|
||||||
|
@ -270,20 +270,6 @@ func (detacher *azureDiskDetacher) Detach(diskName string, nodeName types.NodeNa
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// WaitForDetach detects if the disk is detached on the node
|
|
||||||
func (detacher *azureDiskDetacher) WaitForDetach(devicePath string, timeout time.Duration) error {
|
|
||||||
return wait.Poll(checkSleepDuration, timeout, func() (bool, error) {
|
|
||||||
glog.V(4).Infof("Checking device %q is detached.", devicePath)
|
|
||||||
if pathExists, err := util.PathExists(devicePath); err != nil {
|
|
||||||
return false, fmt.Errorf("Error checking if device path exists: %v", err)
|
|
||||||
} else if !pathExists {
|
|
||||||
return true, nil
|
|
||||||
} else {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmountDevice unmounts the volume on the node
|
// UnmountDevice unmounts the volume on the node
|
||||||
func (detacher *azureDiskDetacher) UnmountDevice(deviceMountPath string) error {
|
func (detacher *azureDiskDetacher) UnmountDevice(deviceMountPath string) error {
|
||||||
volume := path.Base(deviceMountPath)
|
volume := path.Base(deviceMountPath)
|
||||||
|
@ -276,27 +276,6 @@ func (detacher *cinderDiskDetacher) Detach(deviceMountPath string, nodeName type
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (detacher *cinderDiskDetacher) WaitForDetach(devicePath string, timeout time.Duration) error {
|
|
||||||
ticker := time.NewTicker(checkSleepDuration)
|
|
||||||
defer ticker.Stop()
|
|
||||||
timer := time.NewTimer(timeout)
|
|
||||||
defer timer.Stop()
|
|
||||||
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-ticker.C:
|
|
||||||
glog.V(5).Infof("Checking device %q is detached.", devicePath)
|
|
||||||
if pathExists, err := volumeutil.PathExists(devicePath); err != nil {
|
|
||||||
return fmt.Errorf("Error checking if device path exists: %v", err)
|
|
||||||
} else if !pathExists {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
case <-timer.C:
|
|
||||||
return fmt.Errorf("Timeout reached; PD Device %v is still attached", devicePath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (detacher *cinderDiskDetacher) UnmountDevice(deviceMountPath string) error {
|
func (detacher *cinderDiskDetacher) UnmountDevice(deviceMountPath string) error {
|
||||||
return volumeutil.UnmountPath(deviceMountPath, detacher.mounter)
|
return volumeutil.UnmountPath(deviceMountPath, detacher.mounter)
|
||||||
}
|
}
|
||||||
|
@ -270,27 +270,6 @@ func (detacher *gcePersistentDiskDetacher) Detach(deviceMountPath string, nodeNa
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (detacher *gcePersistentDiskDetacher) WaitForDetach(devicePath string, timeout time.Duration) error {
|
|
||||||
ticker := time.NewTicker(checkSleepDuration)
|
|
||||||
defer ticker.Stop()
|
|
||||||
timer := time.NewTimer(timeout)
|
|
||||||
defer timer.Stop()
|
|
||||||
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-ticker.C:
|
|
||||||
glog.V(5).Infof("Checking device %q is detached.", devicePath)
|
|
||||||
if pathExists, err := volumeutil.PathExists(devicePath); err != nil {
|
|
||||||
return fmt.Errorf("Error checking if device path exists: %v", err)
|
|
||||||
} else if !pathExists {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
case <-timer.C:
|
|
||||||
return fmt.Errorf("Timeout reached; PD Device %v is still attached", devicePath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (detacher *gcePersistentDiskDetacher) UnmountDevice(deviceMountPath string) error {
|
func (detacher *gcePersistentDiskDetacher) UnmountDevice(deviceMountPath string) error {
|
||||||
return volumeutil.UnmountPath(deviceMountPath, detacher.host.GetMounter())
|
return volumeutil.UnmountPath(deviceMountPath, detacher.host.GetMounter())
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,6 @@ type FakeVolume struct {
|
|||||||
AttachCallCount int
|
AttachCallCount int
|
||||||
DetachCallCount int
|
DetachCallCount int
|
||||||
WaitForAttachCallCount int
|
WaitForAttachCallCount int
|
||||||
WaitForDetachCallCount int
|
|
||||||
MountDeviceCallCount int
|
MountDeviceCallCount int
|
||||||
UnmountDeviceCallCount int
|
UnmountDeviceCallCount int
|
||||||
GetDeviceMountPathCallCount int
|
GetDeviceMountPathCallCount int
|
||||||
@ -435,13 +434,6 @@ func (fv *FakeVolume) GetDetachCallCount() int {
|
|||||||
return fv.DetachCallCount
|
return fv.DetachCallCount
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fv *FakeVolume) WaitForDetach(devicePath string, timeout time.Duration) error {
|
|
||||||
fv.Lock()
|
|
||||||
defer fv.Unlock()
|
|
||||||
fv.WaitForDetachCallCount++
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (fv *FakeVolume) UnmountDevice(globalMountPath string) error {
|
func (fv *FakeVolume) UnmountDevice(globalMountPath string) error {
|
||||||
fv.Lock()
|
fv.Lock()
|
||||||
defer fv.Unlock()
|
defer fv.Unlock()
|
||||||
|
@ -172,11 +172,6 @@ type Detacher interface {
|
|||||||
// Detach the given device from the node with the given Name.
|
// Detach the given device from the node with the given Name.
|
||||||
Detach(deviceName string, nodeName types.NodeName) error
|
Detach(deviceName string, nodeName types.NodeName) error
|
||||||
|
|
||||||
// WaitForDetach blocks until the device is detached from this
|
|
||||||
// node. If the device does not detach within the given timeout
|
|
||||||
// period an error is returned.
|
|
||||||
WaitForDetach(devicePath string, timeout time.Duration) error
|
|
||||||
|
|
||||||
// UnmountDevice unmounts the global mount of the disk. This
|
// UnmountDevice unmounts the global mount of the disk. This
|
||||||
// should only be called once all bind mounts have been
|
// should only be called once all bind mounts have been
|
||||||
// unmounted.
|
// unmounted.
|
||||||
|
@ -251,27 +251,6 @@ func (detacher *vsphereVMDKDetacher) Detach(deviceMountPath string, nodeName typ
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (detacher *vsphereVMDKDetacher) WaitForDetach(devicePath string, timeout time.Duration) error {
|
|
||||||
ticker := time.NewTicker(checkSleepDuration)
|
|
||||||
defer ticker.Stop()
|
|
||||||
timer := time.NewTimer(timeout)
|
|
||||||
defer timer.Stop()
|
|
||||||
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-ticker.C:
|
|
||||||
glog.V(5).Infof("Checking device %q is detached.", devicePath)
|
|
||||||
if pathExists, err := volumeutil.PathExists(devicePath); err != nil {
|
|
||||||
return fmt.Errorf("Error checking if device path exists: %v", err)
|
|
||||||
} else if !pathExists {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
case <-timer.C:
|
|
||||||
return fmt.Errorf("Timeout reached; Device %v is still attached", devicePath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (detacher *vsphereVMDKDetacher) UnmountDevice(deviceMountPath string) error {
|
func (detacher *vsphereVMDKDetacher) UnmountDevice(deviceMountPath string) error {
|
||||||
return volumeutil.UnmountPath(deviceMountPath, detacher.mounter)
|
return volumeutil.UnmountPath(deviceMountPath, detacher.mounter)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user