From b8d1c3bcd878e62fb468a6b8df55454bd8264d00 Mon Sep 17 00:00:00 2001 From: Chakravarthy Nelluri Date: Fri, 1 Sep 2017 20:12:39 -0400 Subject: [PATCH] Fix volume remount on reboot --- .../volumemanager/reconciler/reconciler.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/kubelet/volumemanager/reconciler/reconciler.go b/pkg/kubelet/volumemanager/reconciler/reconciler.go index e9b6f3de4d4..73ac4da99c8 100644 --- a/pkg/kubelet/volumemanager/reconciler/reconciler.go +++ b/pkg/kubelet/volumemanager/reconciler/reconciler.go @@ -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, @@ -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,