From 0a7a7f4866572f67cb9cb3fccff43b60413b7018 Mon Sep 17 00:00:00 2001 From: Rakshith R Date: Wed, 8 Sep 2021 15:07:38 +0530 Subject: [PATCH] util: call WriteCephConfig() in cephcsi.go This commit calls WriteCephConfig() in cephcsi.go to create ceph.conf and keyring if it is not mounted to be used by all cli calls and conn cmds. Before this change, rbd-controller/omap-generator did not create ceph.conf on startup. Signed-off-by: Rakshith R --- cmd/cephcsi.go | 4 ++++ internal/cephfs/driver.go | 4 ---- internal/rbd/driver.go | 5 ----- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/cmd/cephcsi.go b/cmd/cephcsi.go index 1cf351598..67367faa1 100644 --- a/cmd/cephcsi.go +++ b/cmd/cephcsi.go @@ -210,6 +210,10 @@ func main() { } } + if err = util.WriteCephConfig(); err != nil { + log.FatalLogMsg("failed to write ceph configuration file (%v)", err) + } + log.DefaultLog("Starting driver type: %v with name: %v", conf.Vtype, dname) switch conf.Vtype { case rbdType: diff --git a/internal/cephfs/driver.go b/internal/cephfs/driver.go index 9c0da4041..a2daa24fd 100644 --- a/internal/cephfs/driver.go +++ b/internal/cephfs/driver.go @@ -97,10 +97,6 @@ func (fs *Driver) Run(conf *util.Config) { log.FatalLogMsg("cephfs: failed to load ceph mounters: %v", err) } - if err = util.WriteCephConfig(); err != nil { - log.FatalLogMsg("failed to write ceph configuration file: %v", err) - } - // Use passed in instance ID, if provided for omap suffix naming if conf.InstanceID != "" { CSIInstanceID = conf.InstanceID diff --git a/internal/rbd/driver.go b/internal/rbd/driver.go index c82ee0b21..b5c2943eb 100644 --- a/internal/rbd/driver.go +++ b/internal/rbd/driver.go @@ -106,11 +106,6 @@ func (r *Driver) Run(conf *util.Config) { var err error var topology map[string]string - // Create ceph.conf for use with CLI commands - if err = util.WriteCephConfig(); err != nil { - log.FatalLogMsg("failed to write ceph configuration file (%v)", err) - } - // Use passed in instance ID, if provided for omap suffix naming if conf.InstanceID != "" { CSIInstanceID = conf.InstanceID