CAS-1379 Basic process management for mon/osd procs

This commit is contained in:
Jared Watts
2016-09-08 13:09:23 -07:00
parent c681df01e7
commit 20d48ec85f
6 changed files with 28 additions and 10 deletions
Generated
+4 -3
View File
@@ -1,5 +1,5 @@
hash: 92b0b86293cd8ff7e45e4b92b4d116a38ea8c3a7b92137fd618742f3c67a7b15
updated: 2016-08-31T09:18:34.23005271-07:00
hash: e304bcf51126db7c40de2ad0abe6cf24b9d5153ef72b49244c5722f30af4e61d
updated: 2016-09-08T13:07:22.421779478-07:00
imports:
- name: github.com/coreos/etcd
version: d53923c636e0e4ab7f00cb75681b97a8f11f5a9d
@@ -15,11 +15,12 @@ imports:
- name: github.com/inconshreveable/mousetrap
version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75
- name: github.com/quantum/clusterd
version: 27cbadad4d31c6769e8bd3d0cd4d7908f1fe5590
version: dfc6f8c199d906c4206cce9e9f80a301ad1f22b8
subpackages:
- pkg/inventory
- pkg/orchestrator
- pkg/util
- pkg/proc
- name: github.com/spf13/cobra
version: dbb7c2d02e284aa24423e3e6e105969dffe6e4d6
subpackages:
+2
View File
@@ -8,10 +8,12 @@ import:
- client
- error
- package: github.com/quantum/clusterd
version: dfc6f8c199d906c4206cce9e9f80a301ad1f22b8
subpackages:
- pkg/inventory
- pkg/orchestrator
- pkg/util
- pkg/proc
- package: github.com/spf13/pflag
- package: github.com/google/uuid
- package: github.com/go-ini/ini
+7 -3
View File
@@ -4,13 +4,14 @@ import (
"fmt"
"os"
"os/signal"
"time"
"github.com/spf13/cobra"
"github.com/quantum/castle/pkg/castled"
"github.com/quantum/castle/pkg/util"
"github.com/quantum/clusterd/pkg/orchestrator"
clusterutil "github.com/quantum/clusterd/pkg/util"
"github.com/quantum/clusterd/pkg/proc"
)
var (
@@ -56,8 +57,11 @@ func joinCluster(cmd *cobra.Command, args []string) error {
}
services := []*orchestrator.ClusterService{castled.NewCephService(devices, forceFormat)}
procMan := &clusterutil.ProcManager{}
defer procMan.Shutdown()
procMan := &proc.ProcManager{}
defer func() {
procMan.Shutdown()
<-time.After(time.Duration(1) * time.Second)
}()
// start the cluster orchestration services
if err := orchestrator.StartJoinCluster(services, procMan, discoveryURL, privateIPv4); err != nil {
+7 -2
View File
@@ -7,11 +7,13 @@ import (
"os"
"path"
"path/filepath"
"regexp"
"time"
ctx "golang.org/x/net/context"
"github.com/quantum/clusterd/pkg/orchestrator"
"github.com/quantum/clusterd/pkg/proc"
"github.com/quantum/clusterd/pkg/util"
)
@@ -138,11 +140,14 @@ func (a *monAgent) runMonitor(context *orchestrator.ClusterContext, monitor *Cep
// start the monitor daemon in the foreground with the given config
log.Printf("starting monitor %s", monitor.Name)
monNameArg := fmt.Sprintf("--name=mon.%s", monitor.Name)
err := context.ProcMan.Start(
"mon",
regexp.QuoteMeta(monNameArg),
proc.ReuseExisting,
"--foreground",
fmt.Sprintf("--cluster=%v", a.cluster.Name),
fmt.Sprintf("--name=mon.%v", monitor.Name),
fmt.Sprintf("--cluster=%s", a.cluster.Name),
monNameArg,
fmt.Sprintf("--mon-data=%s", getMonDataDirPath(monitor.Name)),
fmt.Sprintf("--conf=%s", getConfFilePath(getMonRunDirPath(monitor.Name), a.cluster.Name)),
fmt.Sprintf("--public-addr=%s", monitor.Endpoint))
+2 -1
View File
@@ -16,6 +16,7 @@ import (
"github.com/google/uuid"
"github.com/quantum/castle/pkg/cephd"
"github.com/quantum/clusterd/pkg/proc"
"github.com/quantum/clusterd/pkg/util"
)
@@ -400,7 +401,7 @@ func createOSDFileSystem(clusterName string, osdID int, osdUUID uuid.UUID, osdDa
}
// create the OSD file system and journal
err := util.RunChildProcess(
err := proc.RunChildProcess(
"osd",
"--mkfs",
"--mkkey",
+6 -1
View File
@@ -6,6 +6,7 @@ import (
"os"
"path"
"path/filepath"
"regexp"
"strconv"
"strings"
@@ -13,6 +14,7 @@ import (
"github.com/quantum/castle/pkg/cephd"
"github.com/quantum/clusterd/pkg/orchestrator"
"github.com/quantum/clusterd/pkg/proc"
"github.com/quantum/clusterd/pkg/util"
)
@@ -157,8 +159,11 @@ func (a *osdAgent) createOSDs(adminConn *cephd.Conn, context *orchestrator.Clust
func (a *osdAgent) runOSD(context *orchestrator.ClusterContext, clusterName string, osdID int, osdUUID uuid.UUID, osdDataPath string) error {
// start the OSD daemon in the foreground with the given config
log.Printf("starting osd %d at %s", osdID, osdDataPath)
osdUUIDArg := fmt.Sprintf("--osd-uuid=%s", osdUUID.String())
err := context.ProcMan.Start(
"osd",
regexp.QuoteMeta(osdUUIDArg),
proc.ReuseExisting,
"--foreground",
fmt.Sprintf("--id=%s", strconv.Itoa(osdID)),
fmt.Sprintf("--cluster=%s", clusterName),
@@ -166,7 +171,7 @@ func (a *osdAgent) runOSD(context *orchestrator.ClusterContext, clusterName stri
fmt.Sprintf("--osd-journal=%s", getOSDJournalPath(osdDataPath)),
fmt.Sprintf("--conf=%s", getOSDConfFilePath(osdDataPath, clusterName)),
fmt.Sprintf("--keyring=%s", getOSDKeyringPath(osdDataPath)),
fmt.Sprintf("--osd-uuid=%s", osdUUID.String()))
osdUUIDArg)
if err != nil {
return fmt.Errorf("failed to start osd %d: %+v", osdID, err)
}