Skip to content

Commit 8c98bca

Browse files
committed
[service] unify mds service name between v1 and v2
1 parent 1e01fae commit 8c98bca

File tree

31 files changed

+155
-143
lines changed

31 files changed

+155
-143
lines changed

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"env": {
1414
"CGO_ENABLED": "1",
1515
"PATH": "/opt/rh/gcc-toolset-13/root/usr/bin:${env:PATH}",
16-
"dingo_cluster": "main"
16+
"dingo_cluster": "v4.0"
1717
},
1818
"args": [
1919
"deploy",
@@ -133,7 +133,7 @@
133133
},
134134
"args": [
135135
"enter",
136-
"a494b41bde22"
136+
"1b63c303ff16"
137137
],
138138
"showLog": true,
139139
},

cli/cli/cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ func (dingoadm *DingoAdm) CheckRole(role string) error {
452452

453453
kind := dcs[0].GetKind()
454454
roles := topology.CURVEBS_ROLES
455-
if kind == topology.KIND_CURVEFS || kind == topology.KIND_DINGOFS {
455+
if kind == topology.KIND_DINGOFS {
456456
roles = topology.DINGOFS_ROLES
457457
} else if kind == topology.KIND_DINGODB {
458458
roles = topology.DINGODB_ROLES

cli/command/client/enter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func runEnter(dingoadm *cli.DingoAdm, options enterOptions) error {
6868
// 2) attch remote container
6969
client := clients[0]
7070
home := "/curvebs/nebd"
71-
if client.Kind == topology.KIND_CURVEFS || client.Kind == topology.KIND_DINGOFS {
71+
if client.Kind == topology.KIND_DINGOFS {
7272
home = "/dingofs/client"
7373
}
7474
return tools.AttachRemoteContainer(dingoadm, client.Host, client.ContainerId, home)

cli/command/client/install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ type installOptions struct {
5454

5555
func checkInstallOptions(curveadm *cli.DingoAdm, options installOptions) error {
5656
kind := options.kind
57-
if kind != topology.KIND_CURVEBS && kind != topology.KIND_CURVEFS && kind != topology.KIND_DINGOFS {
57+
if kind != topology.KIND_DINGOFS {
5858
return errno.ERR_UNSUPPORT_CLIENT_KIND.F("kind: %s", kind)
5959
} else if !utils.PathExist(options.filename) {
6060
return errno.ERR_CLIENT_CONFIGURE_FILE_NOT_EXIST.

cli/command/client/mount.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func runMount(dingoadm *cli.DingoAdm, options mountOptions) error {
148148
cc, err := configure.ParseClientConfig(options.filename, options.mountFSType)
149149
if err != nil {
150150
return err
151-
} else if cc.GetKind() != topology.KIND_CURVEFS && cc.GetKind() != topology.KIND_DINGOFS {
151+
} else if cc.GetKind() != topology.KIND_DINGOFS {
152152
return errno.ERR_REQUIRE_CURVEFS_KIND_CLIENT_CONFIGURE_FILE.
153153
F("kind: %s", cc.GetKind())
154154
}

cli/command/client/uninstall.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ type uninstallOptions struct {
5151

5252
func checkUninstallOptions(curveadm *cli.DingoAdm, options uninstallOptions) error {
5353
kind := options.kind
54-
if kind != topology.KIND_CURVEBS && kind != topology.KIND_CURVEFS && kind != topology.KIND_DINGOFS {
54+
if kind != topology.KIND_DINGOFS {
5555
return errno.ERR_UNSUPPORT_CLIENT_KIND.
5656
F("kind: %s", kind)
5757
}

cli/command/config/commit.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ func genCheckTopologyPlaybook(dingoadm *cli.DingoAdm,
122122

123123
var skipRoles []string
124124
if kind == topology.KIND_DINGOFS {
125-
if !utils.Contains(roles, topology.ROLE_MDS_V2) {
125+
if !utils.Contains(roles, topology.ROLE_COORDINATOR) {
126126
skipRoles = append(skipRoles, topology.ROLE_COORDINATOR, topology.ROLE_STORE, topology.ROLE_MDS_V2)
127+
} else {
128+
skipRoles = append(skipRoles, topology.ROLE_ETCD, topology.ROLE_METASERVER, topology.ROLE_MDS_V2)
127129
}
128130
}
129131

cli/command/deploy.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ const (
7979
START_DINGODB_WEB = playbook.START_DINGODB_WEB
8080

8181
// role
82-
ROLE_ETCD = topology.ROLE_ETCD
83-
ROLE_MDS = topology.ROLE_MDS
82+
ROLE_ETCD = topology.ROLE_ETCD
83+
// ROLE_MDS_V1 = topology.ROLE_MDS_V1
8484
ROLE_CHUNKSERVER = topology.ROLE_CHUNKSERVER
8585
ROLE_SNAPSHOTCLONE = topology.ROLE_SNAPSHOTCLONE
8686
ROLE_METASERVER = topology.ROLE_METASERVER
@@ -186,13 +186,13 @@ var (
186186
DEPLOY_FILTER_ROLE = map[int]string{
187187
START_ETCD: ROLE_ETCD,
188188
ENABLE_ETCD_AUTH: ROLE_ETCD,
189-
START_MDS: ROLE_MDS,
189+
START_MDS: ROLE_MDS_V2,
190190
START_CHUNKSERVER: ROLE_CHUNKSERVER,
191191
START_SNAPSHOTCLONE: ROLE_SNAPSHOTCLONE,
192192
START_METASERVER: ROLE_METASERVER,
193-
CREATE_PHYSICAL_POOL: ROLE_MDS,
194-
CREATE_LOGICAL_POOL: ROLE_MDS,
195-
BALANCE_LEADER: ROLE_MDS,
193+
CREATE_PHYSICAL_POOL: ROLE_MDS_V2,
194+
CREATE_LOGICAL_POOL: ROLE_MDS_V2,
195+
BALANCE_LEADER: ROLE_MDS_V2,
196196
START_MDSV2: ROLE_MDS_V2,
197197
START_COORDINATOR: ROLE_COORDINATOR,
198198
START_STORE: ROLE_STORE,
@@ -343,7 +343,7 @@ func genDeployPlaybook(dingoadm *cli.DingoAdm,
343343

344344
switch kind {
345345
case topology.KIND_DINGOFS:
346-
if utils.Contains(roles, topology.ROLE_MDS_V2) {
346+
if utils.Contains(roles, topology.ROLE_COORDINATOR) {
347347
if len(roles) == 1 {
348348
// only mds v2, no coordinator/store
349349
steps = DINGOFS_MDSV2_ONLY_DEPLOY_STEPS
@@ -431,7 +431,7 @@ func statistics(dcs []*topology.DeployConfig) map[string]int {
431431
func serviceStats(dingoadm *cli.DingoAdm, dcs []*topology.DeployConfig) string {
432432
count := statistics(dcs)
433433
netcd := count[topology.ROLE_ETCD]
434-
nmds := count[topology.ROLE_MDS]
434+
nmds := count[topology.ROLE_MDS_V2]
435435
nchunkserevr := count[topology.ROLE_METASERVER]
436436
nsnapshotclone := count[topology.ROLE_SNAPSHOTCLONE]
437437
nmetaserver := count[topology.ROLE_METASERVER]
@@ -449,7 +449,7 @@ func serviceStats(dingoadm *cli.DingoAdm, dcs []*topology.DeployConfig) string {
449449
nstore := count[topology.ROLE_STORE]
450450
nmdsv2 := count[topology.ROLE_MDS_V2]
451451
nexecutor := count[topology.ROLE_DINGODB_EXECUTOR]
452-
serviceStats = fmt.Sprintf("coordinator*%d, store*%d, mdsv2*%d, executor*%d", ncoordinator, nstore, nmdsv2, nexecutor)
452+
serviceStats = fmt.Sprintf("coordinator*%d, store*%d, mds*%d, executor*%d", ncoordinator, nstore, nmdsv2, nexecutor)
453453
} else {
454454
// mds v1
455455
serviceStats = fmt.Sprintf("etcd*%d, mds*%d, metaserver*%d", netcd, nmds, nmetaserver)

cli/command/exec.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type execOptions struct {
4141
cmd string
4242
}
4343

44-
func NewExecCommand(curveadm *cli.DingoAdm) *cobra.Command {
44+
func NewExecCommand(dingoadm *cli.DingoAdm) *cobra.Command {
4545
var options execOptions
4646

4747
cmd := &cobra.Command{
@@ -51,10 +51,10 @@ func NewExecCommand(curveadm *cli.DingoAdm) *cobra.Command {
5151
options.id = args[0]
5252
options.cmd = strings.Join(args[1:], " ")
5353
args = args[:1]
54-
return curveadm.CheckId(options.id)
54+
return dingoadm.CheckId(options.id)
5555
},
5656
RunE: func(cmd *cobra.Command, args []string) error {
57-
return runExec(curveadm, options)
57+
return runExec(dingoadm, options)
5858
},
5959
DisableFlagsInUseLine: true,
6060
}
@@ -67,15 +67,15 @@ func NewExecCommand(curveadm *cli.DingoAdm) *cobra.Command {
6767
// 2. filter service
6868
// 3. get container id
6969
// 4. exec cmd in remote container
70-
func runExec(curveadm *cli.DingoAdm, options execOptions) error {
70+
func runExec(dingoadm *cli.DingoAdm, options execOptions) error {
7171
// 1) parse cluster topology
72-
dcs, err := curveadm.ParseTopology()
72+
dcs, err := dingoadm.ParseTopology()
7373
if err != nil {
7474
return err
7575
}
7676

7777
// 2) filter service
78-
dcs = curveadm.FilterDeployConfig(dcs, topology.FilterOption{
78+
dcs = dingoadm.FilterDeployConfig(dcs, topology.FilterOption{
7979
Id: options.id,
8080
Role: "*",
8181
Host: "*",
@@ -86,12 +86,12 @@ func runExec(curveadm *cli.DingoAdm, options execOptions) error {
8686

8787
// 3) get container id
8888
dc := dcs[0]
89-
serviceId := curveadm.GetServiceId(dc.GetId())
90-
containerId, err := curveadm.GetContainerId(serviceId)
89+
serviceId := dingoadm.GetServiceId(dc.GetId())
90+
containerId, err := dingoadm.GetContainerId(serviceId)
9191
if err != nil {
9292
return err
9393
}
9494

9595
// 4) exec cmd in remote container
96-
return tools.ExecCmdInRemoteContainer(curveadm, dc.GetHost(), containerId, options.cmd)
96+
return tools.ExecCmdInRemoteContainer(dingoadm, dc.GetHost(), containerId, options.cmd)
9797
}

cli/command/migrate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ var (
9999

100100
MIGRATE_ROLE_STEPS = map[string][]int{
101101
topology.ROLE_ETCD: MIGRATE_ETCD_STEPS,
102-
topology.ROLE_MDS: MIGRATE_MDS_STEPS,
102+
topology.ROLE_MDS_V2: MIGRATE_MDS_STEPS,
103103
topology.ROLE_CHUNKSERVER: MIGRATE_CHUNKSERVER_STEPS,
104104
topology.ROLE_SNAPSHOTCLONE: MIGRATE_SNAPSHOTCLONE_STEPS,
105105
topology.ROLE_METASERVER: MIGRATE_METASERVER_STEPS,
@@ -210,7 +210,7 @@ func genMigratePlaybook(curveadm *cli.DingoAdm,
210210
config = curveadm.FilterDeployConfigByRole(dcs, topology.ROLE_ETCD)
211211
case CREATE_PHYSICAL_POOL,
212212
CREATE_LOGICAL_POOL:
213-
config = curveadm.FilterDeployConfigByRole(dcs, topology.ROLE_MDS)[:1]
213+
config = curveadm.FilterDeployConfigByRole(dcs, topology.ROLE_MDS_V2)[:1]
214214
}
215215

216216
// options

0 commit comments

Comments
 (0)