mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-27 08:40:23 +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>
(cherry picked from commit c9943320ac
)
This commit is contained in:
parent
67793ecff6
commit
417f9f2030
@ -126,12 +126,18 @@ func (ns *NodeServer) NodeStageVolume(
|
||||
}
|
||||
defer volOptions.Destroy()
|
||||
|
||||
volOptions.NetNamespaceFilePath, err = util.GetCephFSNetNamespaceFilePath(
|
||||
util.CsiConfigFile,
|
||||
volOptions.ClusterID)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
// 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(
|
||||
util.CsiConfigFile,
|
||||
volOptions.ClusterID)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
mnt, err := mounter.New(volOptions)
|
||||
if err != nil {
|
||||
log.ErrorLog(ctx, "failed to create mounter for volume %s: %v", volID, err)
|
||||
|
Loading…
Reference in New Issue
Block a user