mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
move flag configuration variable to util
remove unwanted checks remove getting drivertype from binary name Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
2b1355061e
commit
89732d923f
@ -91,20 +91,20 @@ func NewNodeServer(d *csicommon.CSIDriver, t string) *NodeServer {
|
||||
|
||||
// Run start a non-blocking grpc controller,node and identityserver for
|
||||
// ceph CSI driver which can serve multiple parallel requests
|
||||
func (fs *Driver) Run(driverName, nodeID, endpoint, volumeMounter, mountCacheDir, instanceID, pluginPath string, cachePersister util.CachePersister, t string) {
|
||||
func (fs *Driver) Run(conf *util.Config, cachePersister util.CachePersister) {
|
||||
|
||||
// Configuration
|
||||
PluginFolder = pluginPath
|
||||
PluginFolder = conf.PluginPath
|
||||
|
||||
if err := loadAvailableMounters(); err != nil {
|
||||
klog.Fatalf("cephfs: failed to load ceph mounters: %v", err)
|
||||
}
|
||||
|
||||
if volumeMounter != "" {
|
||||
if err := validateMounter(volumeMounter); err != nil {
|
||||
if conf.VolumeMounter != "" {
|
||||
if err := validateMounter(conf.VolumeMounter); err != nil {
|
||||
klog.Fatalln(err)
|
||||
} else {
|
||||
DefaultVolumeMounter = volumeMounter
|
||||
DefaultVolumeMounter = conf.VolumeMounter
|
||||
}
|
||||
} else {
|
||||
// Pick the first available mounter as the default one.
|
||||
@ -120,8 +120,8 @@ func (fs *Driver) Run(driverName, nodeID, endpoint, volumeMounter, mountCacheDir
|
||||
}
|
||||
|
||||
// Use passed in instance ID, if provided for omap suffix naming
|
||||
if instanceID != "" {
|
||||
CSIInstanceID = instanceID
|
||||
if conf.InstanceID != "" {
|
||||
CSIInstanceID = conf.InstanceID
|
||||
}
|
||||
// Get an instance of the volume journal
|
||||
volJournal = util.NewCSIVolumeJournal()
|
||||
@ -133,8 +133,8 @@ func (fs *Driver) Run(driverName, nodeID, endpoint, volumeMounter, mountCacheDir
|
||||
// metadata pool
|
||||
volJournal.SetNamespace(radosNamespace)
|
||||
|
||||
initVolumeMountCache(driverName, mountCacheDir)
|
||||
if mountCacheDir != "" {
|
||||
initVolumeMountCache(conf.DriverName, conf.MountCacheDir)
|
||||
if conf.MountCacheDir != "" {
|
||||
if err := remountCachedVolumes(); err != nil {
|
||||
klog.Warningf("failed to remount cached volumes: %v", err)
|
||||
// ignore remount fail
|
||||
@ -142,7 +142,7 @@ func (fs *Driver) Run(driverName, nodeID, endpoint, volumeMounter, mountCacheDir
|
||||
}
|
||||
// Initialize default library driver
|
||||
|
||||
fs.cd = csicommon.NewCSIDriver(driverName, util.DriverVersion, nodeID)
|
||||
fs.cd = csicommon.NewCSIDriver(conf.DriverName, util.DriverVersion, conf.NodeID)
|
||||
if fs.cd == nil {
|
||||
klog.Fatalln("failed to initialize CSI driver")
|
||||
}
|
||||
@ -158,11 +158,11 @@ func (fs *Driver) Run(driverName, nodeID, endpoint, volumeMounter, mountCacheDir
|
||||
// Create gRPC servers
|
||||
|
||||
fs.is = NewIdentityServer(fs.cd)
|
||||
fs.ns = NewNodeServer(fs.cd, t)
|
||||
fs.ns = NewNodeServer(fs.cd, conf.Vtype)
|
||||
|
||||
fs.cs = NewControllerServer(fs.cd, cachePersister)
|
||||
|
||||
server := csicommon.NewNonBlockingGRPCServer()
|
||||
server.Start(endpoint, fs.is, fs.cs, fs.ns)
|
||||
server.Start(conf.Endpoint, fs.is, fs.cs, fs.ns)
|
||||
server.Wait()
|
||||
}
|
||||
|
Reference in New Issue
Block a user