Skip to content

Commit

Permalink
Fix the issue that can't import dm
Browse files Browse the repository at this point in the history
  • Loading branch information
lucklove committed Apr 6, 2021
1 parent b135aae commit 579e746
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 7 additions & 2 deletions components/dm/ansible/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,9 @@ func (im *Importer) ImportFromAnsibleDir(ctx context.Context) (clusterName strin
case "dm_master_servers":
for _, host := range group.Hosts {
srv := &spec.MasterSpec{
Host: host.Vars["ansible_host"],
SSHPort: ansible.GetHostPort(host, cfg),
Host: host.Vars["ansible_host"],
SSHPort: ansible.GetHostPort(host, cfg),
Imported: true,
}

runFileName := filepath.Join(host.Vars["deploy_dir"], "scripts", "run_dm-master.sh")
Expand Down Expand Up @@ -380,6 +381,7 @@ func (im *Importer) ImportFromAnsibleDir(ctx context.Context) (clusterName strin
Host: host.Vars["ansible_host"],
SSHPort: ansible.GetHostPort(host, cfg),
DeployDir: firstNonEmpty(host.Vars["deploy_dir"], topo.GlobalOptions.DeployDir),
Imported: true,
}

runFileName := filepath.Join(host.Vars["deploy_dir"], "scripts", "run_dm-worker.sh")
Expand Down Expand Up @@ -441,6 +443,7 @@ func (im *Importer) ImportFromAnsibleDir(ctx context.Context) (clusterName strin
Host: host.Vars["ansible_host"],
SSHPort: ansible.GetHostPort(host, cfg),
DeployDir: firstNonEmpty(host.Vars["deploy_dir"], topo.GlobalOptions.DeployDir),
Imported: true,
}

runFileName := filepath.Join(host.Vars["deploy_dir"], "scripts", "run_prometheus.sh")
Expand Down Expand Up @@ -489,6 +492,7 @@ func (im *Importer) ImportFromAnsibleDir(ctx context.Context) (clusterName strin
Host: host.Vars["ansible_host"],
SSHPort: ansible.GetHostPort(host, cfg),
DeployDir: firstNonEmpty(host.Vars["deploy_dir"], topo.GlobalOptions.DeployDir),
Imported: true,
}

runFileName := filepath.Join(host.Vars["deploy_dir"], "scripts", "run_alertmanager.sh")
Expand Down Expand Up @@ -546,6 +550,7 @@ func (im *Importer) ImportFromAnsibleDir(ctx context.Context) (clusterName strin
Port: port,
Username: grafanaUser,
Password: grafanaPass,
Imported: true,
}

runFileName := filepath.Join(host.Vars["deploy_dir"], "scripts", "run_grafana.sh")
Expand Down
5 changes: 3 additions & 2 deletions pkg/cluster/manager/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,9 @@ func (m *Manager) Deploy(
iterErr = nil
topo.IterInstance(func(inst spec.Instance) {
if _, found := uniqueHosts[inst.GetHost()]; !found {
// check for "imported" parameter, it can not be true when scaling out
if inst.IsImported() {
// check for "imported" parameter, it can not be true when deploying and scaling out
// only for tidb now, need to support dm
if inst.IsImported() && m.sysName == "tidb" {
iterErr = errors.New(
"'imported' is set to 'true' for new instance, this is only used " +
"for instances imported from tidb-ansible and make no sense when " +
Expand Down

0 comments on commit 579e746

Please sign in to comment.