Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
f7e28680
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f7e28680
编写于
1月 24, 2018
作者:
P
Paul Calabrese
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor new launcher down option
上级
027e6e93
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
53 addition
and
68 deletion
+53
-68
programs/launcher/main.cpp
programs/launcher/main.cpp
+53
-68
未找到文件。
programs/launcher/main.cpp
浏览文件 @
f7e28680
...
...
@@ -376,10 +376,9 @@ struct launcher_def {
void
prep_remote_config_dir
(
eosd_def
&
node
,
host_def
*
host
);
void
launch
(
eosd_def
&
node
,
string
&
gts
);
void
kill
(
launch_modes
mode
,
string
sig_opt
);
vector
<
pair
<
host_def
,
eosd_def
>>
get_nodes
(
const
string
&
node_number_list
);
void
bounce
(
const
string
&
node_numbers
);
bool
bounce_node
(
uint16_t
num
);
void
down
(
const
string
&
node_numbers
);
bool
down_node
(
uint16_t
num
);
void
roll
(
const
string
&
host_names
);
void
start_all
(
string
&
gts
,
launch_modes
mode
);
};
...
...
@@ -1215,93 +1214,79 @@ launcher_def::kill (launch_modes mode, string sig_opt) {
}
}
void
launcher_def
::
bounce
(
const
string
&
node_numbers
)
{
vector
<
pair
<
host_def
,
eosd_def
>>
launcher_def
::
get_nodes
(
const
string
&
node_number_list
)
{
vector
<
pair
<
host_def
,
eosd_def
>>
node_list
;
vector
<
string
>
nodes
;
boost
::
split
(
nodes
,
node_number
s
,
boost
::
is_any_of
(
","
));
boost
::
split
(
nodes
,
node_number
_list
,
boost
::
is_any_of
(
","
));
for
(
string
node_number
:
nodes
)
{
uint16_t
node
=
-
1
;
try
{
node
=
boost
::
lexical_cast
<
uint16_t
,
string
>
(
node_number
);
}
catch
(
boost
::
bad_lexical_cast
&
)
{
cerr
<<
"Bad node number found in node number list for bounce: "
<<
node_number
<<
endl
;
exit
(
-
1
);
catch
(
boost
::
bad_lexical_cast
&
)
{
// This exception will be handled below
}
if
(
!
bounce_node
(
node
))
{
cerr
<<
"Node number not found: "
<<
node
<<
endl
;
if
(
node
<
0
)
{
cerr
<<
"Bad node number found in node number list: "
<<
node_number
<<
endl
;
exit
(
-
1
);
}
}
}
bool
launcher_def
::
bounce_node
(
uint16_t
num
)
{
string
dex
=
num
<
10
?
"0"
:
""
;
dex
+=
boost
::
lexical_cast
<
string
,
uint16_t
>
(
num
);
string
node_name
=
network
.
name
+
dex
;
for
(
auto
host
:
bindings
)
{
for
(
auto
node
:
host
.
instances
)
{
if
(
node_name
==
node
.
name
)
{
string
cmd
=
"cd "
+
host
.
eos_root_dir
+
"; "
+
"export EOSIO_HOME="
+
host
.
eos_root_dir
+
"; "
+
"export EOSIO_TN_NODE="
+
dex
+
"; "
+
"./scripts/tn_bounce.sh"
;
cout
<<
"Bouncing "
<<
node_name
<<
endl
;
if
(
!
do_ssh
(
cmd
,
host
.
host_name
))
{
cerr
<<
"Unable to bounce "
<<
node_name
<<
endl
;
exit
(
-
1
);
string
dex
=
node
<
10
?
"0"
:
""
;
dex
+=
boost
::
lexical_cast
<
string
,
uint16_t
>
(
node
);
string
node_name
=
network
.
name
+
dex
;
for
(
auto
host
:
bindings
)
{
for
(
auto
node
:
host
.
instances
)
{
if
(
node_name
==
node
.
name
)
{
node_list
.
push_back
(
make_pair
(
host
,
node
));
goto
continue_next_node
;
}
return
true
;
}
}
cerr
<<
"Unable to find node "
<<
node_name
<<
endl
;
exit
(
-
1
);
continue_next_node:
;
}
return
false
;
return
node_list
;
}
void
launcher_def
::
down
(
const
string
&
node_numbers
)
{
vector
<
string
>
nodes
;
boost
::
split
(
nodes
,
node_numbers
,
boost
::
is_any_of
(
","
));
for
(
string
node_number
:
nodes
)
{
uint16_t
node
=
-
1
;
try
{
node
=
boost
::
lexical_cast
<
uint16_t
,
string
>
(
node_number
);
}
catch
(
boost
::
bad_lexical_cast
&
)
{
cerr
<<
"Bad node number found in node number list for down: "
<<
node_number
<<
endl
;
exit
(
-
1
);
}
if
(
!
down_node
(
node
))
{
cerr
<<
"Node number not found: "
<<
node
<<
endl
;
launcher_def
::
bounce
(
const
string
&
node_numbers
)
{
auto
node_list
=
get_nodes
(
node_numbers
);
for
(
auto
node_pair
:
node_list
)
{
const
host_def
&
host
=
node_pair
.
first
;
const
eosd_def
&
node
=
node_pair
.
second
;
string
node_num
=
node
.
name
.
substr
(
node
.
name
.
length
()
-
2
);
string
cmd
=
"cd "
+
host
.
eos_root_dir
+
"; "
+
"export EOSIO_HOME="
+
host
.
eos_root_dir
+
string
(
"; "
)
+
"export EOSIO_TN_NODE="
+
node_num
+
"; "
+
"./scripts/tn_bounce.sh"
;
cout
<<
"Bouncing "
<<
node
.
name
<<
endl
;
if
(
!
do_ssh
(
cmd
,
host
.
host_name
))
{
cerr
<<
"Unable to bounce "
<<
node
.
name
<<
endl
;
exit
(
-
1
);
}
}
}
bool
launcher_def
::
down_node
(
uint16_t
num
)
{
string
dex
=
num
<
10
?
"0"
:
""
;
dex
+=
boost
::
lexical_cast
<
string
,
uint16_t
>
(
num
);
string
node_name
=
network
.
name
+
dex
;
for
(
auto
host
:
bindings
)
{
for
(
auto
node
:
host
.
instances
)
{
if
(
node_name
==
node
.
name
)
{
string
cmd
=
"cd "
+
host
.
eos_root_dir
+
"; "
+
"export EOSIO_HOME="
+
host
.
eos_root_dir
+
"; "
+
"export EOSIO_TN_NODE="
+
dex
+
"; "
+
"export EOSIO_TN_RESTART_DATA_DIR="
+
node
.
data_dir
+
"; "
+
"./scripts/tn_down.sh"
;
cout
<<
"Bouncing "
<<
node_name
<<
endl
;
if
(
!
do_ssh
(
cmd
,
host
.
host_name
))
{
cerr
<<
"Unable to down "
<<
node_name
<<
endl
;
exit
(
-
1
);
}
return
true
;
}
void
launcher_def
::
down
(
const
string
&
node_numbers
)
{
auto
node_list
=
get_nodes
(
node_numbers
);
for
(
auto
node_pair
:
node_list
)
{
const
host_def
&
host
=
node_pair
.
first
;
const
eosd_def
&
node
=
node_pair
.
second
;
string
node_num
=
node
.
name
.
substr
(
node
.
name
.
length
()
-
2
);
string
cmd
=
"cd "
+
host
.
eos_root_dir
+
"; "
+
"export EOSIO_HOME="
+
host
.
eos_root_dir
+
"; "
+
"export EOSIO_TN_NODE="
+
node_num
+
"; "
+
"export EOSIO_TN_RESTART_DATA_DIR="
+
node
.
data_dir
+
"; "
+
"./scripts/tn_down.sh"
;
cout
<<
"Bouncing "
<<
node
.
name
<<
endl
;
if
(
!
do_ssh
(
cmd
,
host
.
host_name
))
{
cerr
<<
"Unable to down "
<<
node
.
name
<<
endl
;
exit
(
-
1
);
}
}
return
false
;
}
void
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录