diff --git a/pkg/cephmgr/mds/agent.go b/pkg/cephmgr/mds/agent.go index a560ed5b8..c2a2d3cff 100644 --- a/pkg/cephmgr/mds/agent.go +++ b/pkg/cephmgr/mds/agent.go @@ -135,6 +135,10 @@ func (a *mdsAgent) startMDS(context *clusterd.Context, cluster *mon.ClusterInfo, // start the monitor daemon in the foreground with the given config logger.Infof("starting mds %s", id) + + confFile := getMDSConfFilePath(context.ConfigDir, id, cluster.Name) + util.WriteFileToLog(logger, confFile) + mdsNameArg := fmt.Sprintf("--name=mds.%s", id) mdsProc, err := context.ProcMan.Start( fmt.Sprintf("mds%s", id), @@ -144,7 +148,7 @@ func (a *mdsAgent) startMDS(context *clusterd.Context, cluster *mon.ClusterInfo, "--foreground", mdsNameArg, fmt.Sprintf("--cluster=%s", cluster.Name), - fmt.Sprintf("--conf=%s", getMDSConfFilePath(context.ConfigDir, id, cluster.Name)), + fmt.Sprintf("--conf=%s", confFile), fmt.Sprintf("--keyring=%s", getMDSKeyringPath(context.ConfigDir, id)), "-i", id) if err != nil { diff --git a/pkg/cephmgr/mon/agent.go b/pkg/cephmgr/mon/agent.go index 547ca8594..4acf4f2d9 100644 --- a/pkg/cephmgr/mon/agent.go +++ b/pkg/cephmgr/mon/agent.go @@ -168,6 +168,9 @@ func (a *agent) runMonitor(context *clusterd.Context, cluster *ClusterInfo, moni return fmt.Errorf("missing endpoint for mon %s", monitor.Name) } + confFile := GetConfFilePath(getMonRunDirPath(context.ConfigDir, monitor.Name), cluster.Name) + util.WriteFileToLog(logger, confFile) + // start the monitor daemon in the foreground with the given config logger.Infof("starting monitor %s", monitor.Name) monNameArg := fmt.Sprintf("--name=mon.%s", monitor.Name) @@ -180,7 +183,7 @@ func (a *agent) runMonitor(context *clusterd.Context, cluster *ClusterInfo, moni fmt.Sprintf("--cluster=%s", cluster.Name), monNameArg, fmt.Sprintf("--mon-data=%s", getMonDataDirPath(context.ConfigDir, monitor.Name)), - fmt.Sprintf("--conf=%s", GetConfFilePath(getMonRunDirPath(context.ConfigDir, monitor.Name), cluster.Name)), + fmt.Sprintf("--conf=%s", confFile), fmt.Sprintf("--public-addr=%s", monitor.Endpoint)) if err != nil { return fmt.Errorf("failed to start monitor %s: %v", monitor.Name, err) diff --git a/pkg/cephmgr/osd/agent.go b/pkg/cephmgr/osd/agent.go index 7de8eafc7..d1c15221b 100644 --- a/pkg/cephmgr/osd/agent.go +++ b/pkg/cephmgr/osd/agent.go @@ -454,13 +454,15 @@ func (a *osdAgent) runOSD(context *clusterd.Context, clusterName string, config // start the OSD daemon in the foreground with the given config logger.Infof("starting osd %d at %s", config.id, config.rootPath) - osdUUIDArg := fmt.Sprintf("--osd-uuid=%s", config.uuid.String()) + confFile := getOSDConfFilePath(config.rootPath, clusterName) + util.WriteFileToLog(logger, confFile) + osdUUIDArg := fmt.Sprintf("--osd-uuid=%s", config.uuid.String()) params := []string{"--foreground", fmt.Sprintf("--id=%d", config.id), fmt.Sprintf("--cluster=%s", clusterName), fmt.Sprintf("--osd-data=%s", config.rootPath), - fmt.Sprintf("--conf=%s", getOSDConfFilePath(config.rootPath, clusterName)), + fmt.Sprintf("--conf=%s", confFile), fmt.Sprintf("--keyring=%s", getOSDKeyringPath(config.rootPath)), osdUUIDArg, } diff --git a/pkg/cephmgr/rgw/agent.go b/pkg/cephmgr/rgw/agent.go index d39442ddd..9a26a2b2d 100644 --- a/pkg/cephmgr/rgw/agent.go +++ b/pkg/cephmgr/rgw/agent.go @@ -172,6 +172,10 @@ func (a *rgwAgent) startRGW(context *clusterd.Context, cluster *mon.ClusterInfo) // start the monitor daemon in the foreground with the given config logger.Infof("starting rgw") rgwNameArg := "--name=client.radosgw.gateway" + + confFile := getRGWConfFilePath(context.ConfigDir, cluster.Name) + util.WriteFileToLog(logger, confFile) + rgwProc, err := context.ProcMan.Start( "rgw", "rgw", @@ -180,7 +184,7 @@ func (a *rgwAgent) startRGW(context *clusterd.Context, cluster *mon.ClusterInfo) "--foreground", rgwNameArg, fmt.Sprintf("--cluster=%s", cluster.Name), - fmt.Sprintf("--conf=%s", getRGWConfFilePath(context.ConfigDir, cluster.Name)), + fmt.Sprintf("--conf=%s", confFile), fmt.Sprintf("--keyring=%s", getRGWKeyringPath(context.ConfigDir)), fmt.Sprintf("--rgw-frontends=civetweb port=%d", RGWPort), fmt.Sprintf("--rgw-mime-types-file=%s", getMimeTypesPath(context.ConfigDir))) diff --git a/pkg/util/log.go b/pkg/util/log.go index c46cba3fd..62c25b396 100644 --- a/pkg/util/log.go +++ b/pkg/util/log.go @@ -15,6 +15,20 @@ limitations under the License. */ package util -import "github.com/coreos/pkg/capnslog" +import ( + "io/ioutil" + + "github.com/coreos/pkg/capnslog" +) var logger = capnslog.NewPackageLogger("github.com/rook/rook", "util") + +func WriteFileToLog(logger *capnslog.PackageLogger, path string) { + contents, err := ioutil.ReadFile(path) + if err != nil { + logger.Warningf("failed to write file %s to log: %+v", path, err) + return + } + + logger.Infof("Config file %s:\n%s", path, string(contents)) +}