mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 14:20:19 +00:00
cephfs: skip NetNamespaceFilePath if the volume is pre-provisioned
In case of pre-provisioned volume the clusterID is not set in the volume context as the clusterID is missing we cannot extract the NetNamespaceFilePath from the configuration file. For static volume and dynamically provisioned volume the clusterID is set. Note:- This is a special case to support mounting PV without clusterID parameter. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
f250a09c47
commit
c9943320ac
@ -126,12 +126,18 @@ func (ns *NodeServer) NodeStageVolume(
|
|||||||
}
|
}
|
||||||
defer volOptions.Destroy()
|
defer volOptions.Destroy()
|
||||||
|
|
||||||
|
// Skip extracting NetNamespaceFilePath if the clusterID is empty.
|
||||||
|
// In case of pre-provisioned volume the clusterID is not set in the
|
||||||
|
// volume context.
|
||||||
|
if volOptions.ClusterID != "" {
|
||||||
volOptions.NetNamespaceFilePath, err = util.GetCephFSNetNamespaceFilePath(
|
volOptions.NetNamespaceFilePath, err = util.GetCephFSNetNamespaceFilePath(
|
||||||
util.CsiConfigFile,
|
util.CsiConfigFile,
|
||||||
volOptions.ClusterID)
|
volOptions.ClusterID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, status.Error(codes.Internal, err.Error())
|
return nil, status.Error(codes.Internal, err.Error())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mnt, err := mounter.New(volOptions)
|
mnt, err := mounter.New(volOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ErrorLog(ctx, "failed to create mounter for volume %s: %v", volID, err)
|
log.ErrorLog(ctx, "failed to create mounter for volume %s: %v", volID, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user