mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #51274 from yastij/clean-cinder-detachLogError
Automatic merge from submit-queue (batch tested with PRs 51235, 50819, 51274, 50972, 50504) Clean cinder detachlogerror **What this PR does / why we need it**: **Which issue this PR fixes** : fixes #50441 **Special notes for your reviewer**: **Release note**: ```release-note ```
This commit is contained in:
		@@ -275,13 +275,6 @@ type cinderVolume struct {
 | 
			
		||||
	volume.MetricsNil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func detachDiskLogError(cd *cinderVolume) {
 | 
			
		||||
	err := cd.manager.DetachDisk(&cinderVolumeUnmounter{cd})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		glog.Warningf("Failed to detach disk: %v (%v)", cd, err)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b *cinderVolumeMounter) GetAttributes() volume.Attributes {
 | 
			
		||||
	return volume.Attributes{
 | 
			
		||||
		ReadOnly:        b.readOnly,
 | 
			
		||||
@@ -308,7 +301,6 @@ func (b *cinderVolumeMounter) SetUpAt(dir string, fsGroup *int64) error {
 | 
			
		||||
	b.plugin.volumeLocks.LockKey(b.pdName)
 | 
			
		||||
	defer b.plugin.volumeLocks.UnlockKey(b.pdName)
 | 
			
		||||
 | 
			
		||||
	// TODO: handle failed mounts here.
 | 
			
		||||
	notmnt, err := b.mounter.IsLikelyNotMountPoint(dir)
 | 
			
		||||
	if err != nil && !os.IsNotExist(err) {
 | 
			
		||||
		glog.Errorf("Cannot validate mount point: %s %v", dir, err)
 | 
			
		||||
@@ -326,9 +318,7 @@ func (b *cinderVolumeMounter) SetUpAt(dir string, fsGroup *int64) error {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err := os.MkdirAll(dir, 0750); err != nil {
 | 
			
		||||
		// TODO: we should really eject the attach/detach out into its own control loop.
 | 
			
		||||
		glog.V(4).Infof("Could not create directory %s: %v", dir, err)
 | 
			
		||||
		detachDiskLogError(b.cinderVolume)
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -359,8 +349,6 @@ func (b *cinderVolumeMounter) SetUpAt(dir string, fsGroup *int64) error {
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		os.Remove(dir)
 | 
			
		||||
		// TODO: we should really eject the attach/detach out into its own control loop.
 | 
			
		||||
		detachDiskLogError(b.cinderVolume)
 | 
			
		||||
		glog.Errorf("Failed to mount %s: %v", dir, err)
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user