diff --git a/pkg/cephfs/controllerserver.go b/pkg/cephfs/controllerserver.go index 859e0102a..29a5b20fe 100644 --- a/pkg/cephfs/controllerserver.go +++ b/pkg/cephfs/controllerserver.go @@ -77,12 +77,6 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol volId := newVolumeIdentifier(volOptions, req) - conf := cephConfigData{Monitors: volOptions.Monitors} - if err = conf.writeToFile(); err != nil { - glog.Errorf("couldn't generate ceph.conf: %v", err) - return nil, status.Error(codes.Internal, err.Error()) - } - // Create a volume in case the user didn't provide one if volOptions.ProvisionVolume { diff --git a/pkg/cephfs/nodeserver.go b/pkg/cephfs/nodeserver.go index 52f0a7bbf..6d184f2a3 100644 --- a/pkg/cephfs/nodeserver.go +++ b/pkg/cephfs/nodeserver.go @@ -119,6 +119,12 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis return nil, status.Error(codes.Internal, err.Error()) } + conf := cephConfigData{Monitors: volOptions.Monitors, VolumeUuid: volUuid} + if err = conf.writeToFile(); err != nil { + glog.Errorf("couldn't generate ceph.conf: %v", err) + return nil, status.Error(codes.Internal, err.Error()) + } + // Check if the volume is already mounted isMnt, err := isMountPoint(targetPath)