Skip to content

Commit

Permalink
Merge pull request #53368 from wojtek-t/automated-cherry-pick-of-#519…
Browse files Browse the repository at this point in the history
…85-upstream-release-1.7

Automatic merge from submit-queue.

Automated cherry pick of #51985 upstream release 1.7 

Cherry pick of #51985 on release-1.7.

#51985: Fix volume remount on reboot
  • Loading branch information
Kubernetes Submit Queue authored Oct 9, 2017
2 parents 0a92fe3 + 1fb244a commit 0608e83
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/kubelet/volumemanager/reconciler/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,19 @@ func (rc *reconciler) reconstructVolume(volume podVolume) (*reconstructedVolume,
uniqueVolumeName = volumehelper.GetUniqueVolumeNameForNonAttachableVolume(volume.podName, plugin, volumeSpec)
}

if attachablePlugin != nil {
if isNotMount, mountCheckErr := rc.mounter.IsLikelyNotMountPoint(volume.mountPath); mountCheckErr != nil {
return nil, fmt.Errorf("Could not check whether the volume %q (spec.Name: %q) pod %q (UID: %q) is mounted with: %v",
uniqueVolumeName,
volumeSpec.Name(),
volume.podName,
pod.UID,
mountCheckErr)
} else if isNotMount {
return nil, fmt.Errorf("Volume: %q is not mounted", uniqueVolumeName)
}
}

volumeMounter, newMounterErr := plugin.NewMounter(
volumeSpec,
pod,
Expand Down Expand Up @@ -531,7 +544,9 @@ func (rc *reconciler) updateStates(volumesNeedUpdate map[v1.UniqueVolumeName]*re
glog.Errorf("Could not mark device is mounted to actual state of world: %v", err)
continue
}
glog.Infof("Volume: %v is mounted", volume.volumeName)
}

_, err = rc.desiredStateOfWorld.AddPodToVolume(volume.podName,
volume.pod,
volume.volumeSpec,
Expand Down

0 comments on commit 0608e83

Please sign in to comment.