From e5f6cc53f04bf0c7deaeebe907f5c3a784e5feb8 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 (cherry picked from commit 0a7a7f4866572f67cb9cb3fccff43b60413b7018) --- 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 b97869824..2dce2af17 100644 --- a/cmd/cephcsi.go +++ b/cmd/cephcsi.go @@ -209,6 +209,10 @@ func main() { } } + if err = util.WriteCephConfig(); err != nil { + util.FatalLogMsg("failed to write ceph configuration file (%v)", err) + } + util.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 c8699bbc6..f13b76736 100644 --- a/internal/cephfs/driver.go +++ b/internal/cephfs/driver.go @@ -96,10 +96,6 @@ func (fs *Driver) Run(conf *util.Config) { util.FatalLogMsg("cephfs: failed to load ceph mounters: %v", err) } - if err = util.WriteCephConfig(); err != nil { - util.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 fc073859d..fe5f649e0 100644 --- a/internal/rbd/driver.go +++ b/internal/rbd/driver.go @@ -105,11 +105,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 { - util.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