point sources at cephmgr

This commit is contained in:
Travis Nielsen committed 2016-09-26 16:00:45 -07:00
1 parent 285d50f8a4
commit b89bccec09
3 files changed
+16 -16

No files matched your search

+9 -9
View File
@@ -8,19 +8,19 @@ import (
"net/http"
etcd "github.com/coreos/etcd/client"
"github.com/quantum/castle/pkg/castled"
"github.com/quantum/castle/pkg/cephclient"
"github.com/quantum/castle/pkg/cephmgr"
"github.com/quantum/castle/pkg/clusterd/inventory"
"github.com/quantum/castle/pkg/model"
)
type Handler struct {
EtcdClient etcd.KeysAPI
ConnectionFactory castled.ConnectionFactory
ConnectionFactory cephmgr.ConnectionFactory
CephFactory cephclient.ConnectionFactory
}
func NewHandler(etcdClient etcd.KeysAPI, connFactory castled.ConnectionFactory, cephFactory cephclient.ConnectionFactory) *Handler {
func NewHandler(etcdClient etcd.KeysAPI, connFactory cephmgr.ConnectionFactory, cephFactory cephclient.ConnectionFactory) *Handler {
return &Handler{
EtcdClient: etcdClient,
ConnectionFactory: connFactory,
@@ -57,7 +57,7 @@ func (h *Handler) GetNodes(w http.ResponseWriter, r *http.Request) {
i := 0
for nodeID, n := range clusterInventory.Nodes {
// look up all the disks that the current node has applied OSDs on
appliedSerials, err := castled.GetAppliedOSDs(nodeID, h.EtcdClient)
appliedSerials, err := cephmgr.GetAppliedOSDs(nodeID, h.EtcdClient)
if err != nil {
log.Printf("failed to get applied OSDs for node %s: %+v", nodeID, err)
w.WriteHeader(http.StatusInternalServerError)
@@ -87,8 +87,8 @@ func (h *Handler) GetNodes(w http.ResponseWriter, r *http.Request) {
}
type overallMonStatus struct {
Status castled.MonStatusResponse `json:"status"`
Desired []*castled.CephMonitorConfig `json:"desired"`
Status cephmgr.MonStatusResponse `json:"status"`
Desired []*cephmgr.CephMonitorConfig `json:"desired"`
}
// Gets the monitors that have been created in this cluster.
@@ -96,14 +96,14 @@ type overallMonStatus struct {
// /mon
func (h *Handler) GetMonitors(w http.ResponseWriter, r *http.Request) {
desiredMons, err := castled.GetDesiredMonitors(h.EtcdClient)
desiredMons, err := cephmgr.GetDesiredMonitors(h.EtcdClient)
if err != nil {
log.Printf("failed to load monitors: %+v", err)
w.WriteHeader(http.StatusInternalServerError)
return
}
mons := []*castled.CephMonitorConfig{}
mons := []*cephmgr.CephMonitorConfig{}
if len(desiredMons) == 0 {
// no monitors to connect to
FormatJsonResponse(w, mons)
@@ -118,7 +118,7 @@ func (h *Handler) GetMonitors(w http.ResponseWriter, r *http.Request) {
defer adminConn.Shutdown()
// get the monitor status
monStatusResp, err := castled.GetMonStatus(adminConn)
monStatusResp, err := cephmgr.GetMonStatus(adminConn)
if err != nil {
log.Printf("failed to get mon_status, err: %+v", err)
w.WriteHeader(http.StatusInternalServerError)
+1 -1
View File
@@ -13,9 +13,9 @@ import (
etcd "github.com/coreos/etcd/client"
ctx "golang.org/x/net/context"
"github.com/quantum/castle/pkg/castled/test"
"github.com/quantum/castle/pkg/cephclient"
testceph "github.com/quantum/castle/pkg/cephclient/test"
"github.com/quantum/castle/pkg/cephmgr/test"
"github.com/quantum/castle/pkg/clusterd/inventory"
"github.com/quantum/castle/pkg/util"
"github.com/stretchr/testify/assert"
+6 -6
View File
@@ -13,8 +13,8 @@ import (
"github.com/spf13/pflag"
"github.com/quantum/castle/pkg/api"
"github.com/quantum/castle/pkg/castled"
"github.com/quantum/castle/pkg/cephd"
"github.com/quantum/castle/pkg/cephmgr"
"github.com/quantum/castle/pkg/clusterd"
"github.com/quantum/castle/pkg/proc"
"github.com/quantum/castle/pkg/util"
@@ -22,7 +22,7 @@ import (
var rootCmd = &cobra.Command{
Use: "castled",
Short: "castled tool for bootstrapping and running castle storage.",
Short: "castled tool for bootstrapping and running castle storage",
Long: `https://github.com/quantum/castle`,
}
var cfg = newConfig()
@@ -33,11 +33,11 @@ type config struct {
privateIPv4 string
devices string
forceFormat bool
crushMap *castled.CrushLocation
crushMap *cephmgr.CrushLocation
}
func newConfig() *config {
return &config{crushMap: &castled.CrushLocation{}}
return &config{crushMap: &cephmgr.CrushLocation{}}
}
// Initialize the configuration parameters. The precedence from lowest to highest is:
@@ -89,7 +89,7 @@ func joinCluster(cmd *cobra.Command, args []string) error {
return fmt.Errorf("either discovery-url or etcd-members settings are required")
}
services := []*clusterd.ClusterService{castled.NewCephService(cephd.New(), cfg.devices, cfg.forceFormat, cfg.crushMap)}
services := []*clusterd.ClusterService{cephmgr.NewCephService(cephd.New(), cfg.devices, cfg.forceFormat, cfg.crushMap)}
procMan := &proc.ProcManager{}
defer func() {
procMan.Shutdown()
@@ -104,7 +104,7 @@ func joinCluster(cmd *cobra.Command, args []string) error {
go func() {
// set up routes and start HTTP server for REST API
h := api.NewHandler(context.EtcdClient, castled.NewConnectionFactory(), cephd.New())
h := api.NewHandler(context.EtcdClient, cephmgr.NewConnectionFactory(), cephd.New())
r := api.NewRouter(h.GetRoutes())
if err := http.ListenAndServe(":8124", r); err != nil {
log.Printf("API server error: %+v", err)