From 51d288064945b68b8fc43a7c435d012d213cedc9 Mon Sep 17 00:00:00 2001 From: payes Date: Tue, 10 Dec 2019 16:46:45 +0530 Subject: [PATCH] fix(remount): skip monitoring volume unless mounted (#60) Signed-off-by: Payes --- pkg/utils/v1alpha1/utils.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/utils/v1alpha1/utils.go b/pkg/utils/v1alpha1/utils.go index 62dcfd176..621512316 100644 --- a/pkg/utils/v1alpha1/utils.go +++ b/pkg/utils/v1alpha1/utils.go @@ -230,6 +230,13 @@ func MonitorMounts() { break } for _, vol := range csivolList.Items { + // This check is added to avoid monitoring volume if it has not + // been mounted yet. Although CSIVolume CR gets created at + // ControllerPublish step. + if (vol.Spec.Volume.StagingTargetPath == "") || + (vol.Spec.Volume.TargetPath == "") { + continue + } // Search the volume in the list of mounted volumes at the node // retrieved above stagingMountPoint, stagingPathExists := listContains(