Skip to content

Commit

Permalink
fix: 重建和主从迁移切换后再次刷新周边介质 #1472
Browse files Browse the repository at this point in the history
  • Loading branch information
zfrendo authored and zhangzhw8 committed Oct 24, 2023
1 parent a68472b commit cc2f5c2
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,18 @@ def deploy_migrate_cluster_flow(self):

# 流程: 恢复数据>切换>安装周边>卸载
sub_pipeline.add_parallel_sub_pipeline(sub_flow_list=restore_sub_list)
# 切换前安装周边组件
sub_pipeline.add_sub_pipeline(
sub_flow=build_surrounding_apps_sub_flow(
bk_cloud_id=one_machine["bk_cloud_id"],
master_ip_list=[one_machine["new_master_ip"]],
slave_ip_list=[one_machine["new_slave_ip"]],
root_id=self.root_id,
parent_global_data=copy.deepcopy(ticket_data),
is_init=True,
cluster_type=one_machine["cluster_type"],
)
)
sub_pipeline.add_act(act_name=_("人工确认"), act_component_code=PauseComponent.code, kwargs={})
sub_pipeline.add_parallel_sub_pipeline(sub_flow_list=switch_sub_list)
# 第三步,机器级别再次先安装周边程序
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ def migrate_cluster_flow(self):
tendb_migrate_pipeline.add_act(act_name=_("人工确认切换"), act_component_code=PauseComponent.code, kwargs={})
# 切换迁移实例
tendb_migrate_pipeline.add_parallel_sub_pipeline(sub_flow_list=switch_sub_pipeline_list)
tendb_migrate_pipeline.add_parallel_sub_pipeline(sub_flow_list=surrounding_sub_pipeline_list)
# 卸载流程人工确认
tendb_migrate_pipeline.add_act(act_name=_("人工确认卸载实例"), act_component_code=PauseComponent.code, kwargs={})
# 卸载remote节点
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,17 @@ def deploy_restore_slave_flow(self):
uninstall_slave_sub_list.append(uninstall_slave_sub_pipeline.build_sub_process(_("卸载实例")))
# 流程: 恢复数据>切换>安装周边>卸载
sub_pipeline.add_parallel_sub_pipeline(sub_flow_list=slave_restore_sub_list)
# 切换前安装周边组件
sub_pipeline.add_sub_pipeline(
sub_flow=build_surrounding_apps_sub_flow(
bk_cloud_id=one_machine["bk_cloud_id"],
slave_ip_list=[one_machine["new_slave_ip"]],
root_id=self.root_id,
parent_global_data=copy.deepcopy(ticket_data),
is_init=True,
cluster_type=one_machine["cluster_type"],
)
)
sub_pipeline.add_act(act_name=_("人工确认"), act_component_code=PauseComponent.code, kwargs={})
sub_pipeline.add_parallel_sub_pipeline(sub_flow_list=switch_slave_sub_list)
# 第三步 安装周边
Expand Down Expand Up @@ -419,6 +430,17 @@ def deploy_restore_local_slave_flow(self):
act_component_code=ExecuteDBActuatorScriptComponent.code,
kwargs=asdict(exec_act_kwargs),
)
restore_local_slave_sub_pipeline.add_sub_pipeline(
sub_flow=build_surrounding_apps_sub_flow(
bk_cloud_id=one_cluster["bk_cloud_id"],
slave_ip_list=[one_cluster["new_slave_ip"]],
root_id=self.root_id,
parent_global_data=copy.deepcopy(ticket_data),
is_init=True,
cluster_type=one_cluster["cluster_type"],
)
)

sub_pipeline_list.append(
restore_local_slave_sub_pipeline.build_sub_process(sub_name=_("Restore local Slave 本地重建"))
)
Expand Down Expand Up @@ -551,6 +573,18 @@ def deploy_add_slave_flow(self):
)
),
)

restore_slave_sub_pipeline.add_sub_pipeline(
sub_flow=build_surrounding_apps_sub_flow(
bk_cloud_id=one_cluster["bk_cloud_id"],
slave_ip_list=[one_cluster["new_slave_ip"]],
root_id=self.root_id,
parent_global_data=copy.deepcopy(ticket_data),
is_init=True,
cluster_type=one_cluster["cluster_type"],
)
)

slave_restore_sub_list.append(
restore_slave_sub_pipeline.build_sub_process(sub_name=_("添加Slave之恢复slave"))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ def tendb_ha_restore_slave_flow(self):
tendb_migrate_pipeline.add_act(act_name=_("人工确认切换"), act_component_code=PauseComponent.code, kwargs={})
# 切换迁移实例
tendb_migrate_pipeline.add_parallel_sub_pipeline(sub_flow_list=switch_sub_pipeline_list)
# 切换后再次刷新周边
tendb_migrate_pipeline.add_parallel_sub_pipeline(sub_flow_list=surrounding_sub_pipeline_list)
# 卸载流程人工确认
tendb_migrate_pipeline.add_act(
act_name=_("人工确认卸载实例"), act_component_code=PauseComponent.code, kwargs={}
Expand Down Expand Up @@ -418,6 +420,16 @@ def restore_local_slave_flow(self):
)
),
)
tendb_migrate_pipeline.add_sub_pipeline(
sub_flow=build_surrounding_apps_sub_flow(
bk_cloud_id=cluster_model.bk_cloud_id,
slave_ip_list=[target_slave.machine.ip],
root_id=self.root_id,
parent_global_data=self.data,
is_init=True,
cluster_type=cluster_model.cluster_type,
)
)
tendb_migrate_pipeline_list.append(
tendb_migrate_pipeline.build_sub_process(_("slave原地重建{}").format(self.data["slave_ip"]))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from backend.db_meta.models import Cluster
from backend.flow.engine.bamboo.scene.common.builder import Builder, SubBuilder
from backend.flow.engine.bamboo.scene.common.get_file_list import GetFileList
from backend.flow.engine.bamboo.scene.mysql.common.common_sub_flow import build_surrounding_apps_sub_flow
from backend.flow.engine.bamboo.scene.mysql.common.recover_slave_instance import slave_recover_sub_flow
from backend.flow.plugins.components.collections.mysql.exec_actuator_script import ExecuteDBActuatorScriptComponent
from backend.flow.plugins.components.collections.mysql.mysql_db_meta import MySQLDBMetaComponent
Expand Down Expand Up @@ -165,6 +166,18 @@ def tendb_remote_slave_local_recover(self):
)
)
tendb_migrate_pipeline.add_parallel_sub_pipeline(sub_flow_list=sync_data_sub_pipeline_list)
# 安装周边
tendb_migrate_pipeline.add_sub_pipeline(
sub_flow=build_surrounding_apps_sub_flow(
bk_cloud_id=cluster_class.bk_cloud_id,
master_ip_list=None,
slave_ip_list=[self.data["slave_ip"]],
root_id=self.root_id,
parent_global_data=copy.deepcopy(self.data),
is_init=True,
cluster_type=cluster_class.cluster_type,
)
)
tendb_migrate_pipeline_all_list.append(
tendb_migrate_pipeline.build_sub_process(_("slave原地重建{}".format(self.data["slave_ip"])))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ def tendb_remote_slave_recover(self):
tendb_migrate_pipeline.add_parallel_sub_pipeline(sub_flow_list=install_sub_pipeline_list)
# 数据同步
tendb_migrate_pipeline.add_parallel_sub_pipeline(sub_flow_list=sync_data_sub_pipeline_list)
# 数据同步完毕 安装周边
tendb_migrate_pipeline.add_parallel_sub_pipeline(sub_flow_list=surrounding_sub_pipeline_list)
# 人工确认切换迁移实例
tendb_migrate_pipeline.add_act(act_name=_("人工确认切换"), act_component_code=PauseComponent.code, kwargs={})
# 切换迁移实例
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ def tendb_migrate(self):
tendb_migrate_pipeline.add_parallel_sub_pipeline(sub_flow_list=install_sub_pipeline_list)
# 数据同步
tendb_migrate_pipeline.add_parallel_sub_pipeline(sub_flow_list=sync_data_sub_pipeline_list)
# 切换前安装周边
tendb_migrate_pipeline.add_parallel_sub_pipeline(sub_flow_list=surrounding_sub_pipeline_list)
# 人工确认切换迁移实例
tendb_migrate_pipeline.add_act(act_name=_("人工确认切换"), act_component_code=PauseComponent.code, kwargs={})
# 切换迁移实例
Expand Down

0 comments on commit cc2f5c2

Please sign in to comment.