util: read ceph.conf by calling conn.ReadConfigFile(CephConfigPath)

The configurations in cpeh.conf is not picked up by rados connection
automatically, hence we need to call conn.ReadConfigFile before calling
Connect().

Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
Rakshith R 2021-09-07 17:20:51 +05:30 committed by mergify[bot]
parent 76f1b42498
commit e99dd3dea4

View File

@ -145,6 +145,10 @@ func (cp *ConnPool) Get(monitors, user, keyfile string) (*rados.Conn, error) {
return nil, fmt.Errorf("parsing cmdline args (%v) failed: %w", args, err) return nil, fmt.Errorf("parsing cmdline args (%v) failed: %w", args, err)
} }
if err = conn.ReadConfigFile(CephConfigPath); err != nil {
return nil, fmt.Errorf("failed to read config file %q: %w", CephConfigPath, err)
}
err = conn.Connect() err = conn.Connect()
if err != nil { if err != nil {
return nil, fmt.Errorf("connecting failed: %w", err) return nil, fmt.Errorf("connecting failed: %w", err)