From c0353ca20c97fe4bd2f51a4df5118687a5b3e6b1 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Wed, 29 Nov 2017 10:10:32 -0500 Subject: [PATCH 1/2] Remove conditions from PVC after successful resize --- pkg/volume/util/operationexecutor/operation_generator.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/volume/util/operationexecutor/operation_generator.go b/pkg/volume/util/operationexecutor/operation_generator.go index fc682fd607dd..c02c25ac58db 100644 --- a/pkg/volume/util/operationexecutor/operation_generator.go +++ b/pkg/volume/util/operationexecutor/operation_generator.go @@ -1272,6 +1272,7 @@ func updatePVCStatusCapacity(pvcName string, pvc *v1.PersistentVolumeClaim, capa } pvcCopy.Status.Capacity = capacity + pvcCopy.Status.Conditions = []v1.PersistentVolumeClaimCondition{} newData, err := json.Marshal(pvcCopy) if err != nil { From c82d412993d3c4ebb929cb1ce82fc26e77e0964e Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Wed, 29 Nov 2017 11:56:30 -0500 Subject: [PATCH 2/2] Do not resize file system on a read-only mount --- pkg/volume/util/operationexecutor/operation_generator.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/volume/util/operationexecutor/operation_generator.go b/pkg/volume/util/operationexecutor/operation_generator.go index c02c25ac58db..2ff4b668f00b 100644 --- a/pkg/volume/util/operationexecutor/operation_generator.go +++ b/pkg/volume/util/operationexecutor/operation_generator.go @@ -544,6 +544,7 @@ func (og *operationGenerator) resizeFileSystem(volumeToMount VolumeToMount, devi glog.V(6).Infof("Resizing is not enabled for this volume %s", volumeToMount.VolumeName) return nil } + mounter := og.volumePluginMgr.Host.GetMounter(pluginName) // Get expander, if possible expandableVolumePlugin, _ := @@ -565,6 +566,13 @@ func (og *operationGenerator) resizeFileSystem(volumeToMount VolumeToMount, devi // File system resize was requested, proceed glog.V(4).Infof(volumeToMount.GenerateMsgDetailed("MountVolume.resizeFileSystem entering", fmt.Sprintf("DevicePath %q", volumeToMount.DevicePath))) + if volumeToMount.VolumeSpec.ReadOnly { + simpleMsg, detailedMsg := volumeToMount.GenerateMsg("MountVolume.resizeFileSystem failed", "requested read-only file system") + glog.Warningf(detailedMsg) + og.recorder.Eventf(volumeToMount.Pod, v1.EventTypeWarning, kevents.FileSystemResizeFailed, simpleMsg) + return nil + } + diskFormatter := &mount.SafeFormatAndMount{ Interface: mounter, Exec: og.volumePluginMgr.Host.GetExec(expandableVolumePlugin.GetPluginName()),