Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
9376ef4e
I
iSulad
项目概览
openeuler
/
iSulad
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
iSulad
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9376ef4e
编写于
7月 30, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
7月 30, 2020
浏览文件
操作
浏览文件
下载
差异文件
!615 stats: stats --original show correct container name
Merge pull request !615 from Zhangxiaoyu/master
上级
b815e33d
d1977f0d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
49 addition
and
10 deletion
+49
-10
CI/test_cases/container_cases/stats.bash
CI/test_cases/container_cases/stats.bash
+33
-5
src/api/services/containers/container.proto
src/api/services/containers/container.proto
+4
-3
src/client/connect/grpc/grpc_containers_client.cc
src/client/connect/grpc/grpc_containers_client.cc
+3
-0
src/client/libisula.c
src/client/libisula.c
+2
-0
src/client/libisula.h
src/client/libisula.h
+1
-0
src/cmd/isula/extend/stats.c
src/cmd/isula/extend/stats.c
+2
-2
src/daemon/entry/connect/grpc/grpc_containers_service_private.cc
...mon/entry/connect/grpc/grpc_containers_service_private.cc
+3
-0
src/daemon/executor/container_cb/execution_extend.c
src/daemon/executor/container_cb/execution_extend.c
+1
-0
未找到文件。
CI/test_cases/container_cases/stats.bash
浏览文件 @
9376ef4e
...
...
@@ -72,6 +72,13 @@ function test_stats_spec()
cat
$statslog
|
grep
"
${
id_init
:0:12
}
"
[[
$?
-ne
0
]]
&&
msg_err
"
${
FUNCNAME
[0]
}
:
${
LINENO
}
- failed to run container with image:
${
image
}
"
&&
((
ret++
))
container_name_pause
=
stats_paused
id_pause
=
`
isula run
-td
-n
$container_name_pause
$image
/bin/sh
`
[[
$?
-ne
0
]]
&&
msg_err
"
${
FUNCNAME
[0]
}
:
${
LINENO
}
- failed to run container with image:
${
image
}
"
&&
((
ret++
))
isula pause
$id_pause
[[
$?
-ne
0
]]
&&
msg_err
"
${
FUNCNAME
[0]
}
:
${
LINENO
}
- failed to pause running container"
&&
((
ret++
))
container_name_stop
=
stats_stopped
id_stop
=
`
isula run
-td
-n
$container_name_stop
$image
/bin/sh
`
[[
$?
-ne
0
]]
&&
msg_err
"
${
FUNCNAME
[0]
}
:
${
LINENO
}
- failed to run container with image:
${
image
}
"
&&
((
ret++
))
...
...
@@ -79,19 +86,40 @@ function test_stats_spec()
isula stop
$id_stop
[[
$?
-ne
0
]]
&&
msg_err
"
${
FUNCNAME
[0]
}
:
${
LINENO
}
- failed to stop running container"
&&
((
ret++
))
isula stats
--original
>
$statslog
[[
$?
-ne
0
]]
&&
msg_err
"
${
FUNCNAME
[0]
}
:
${
LINENO
}
- failed to stats --original"
&&
((
ret++
))
cat
$statslog
|
grep
"
${
id_init
:0:12
}
"
[[
$?
-eq
0
]]
&&
msg_err
"
${
FUNCNAME
[0]
}
:
${
LINENO
}
- stats the inited container(should not)"
&&
((
ret++
))
cat
$statslog
|
grep
"
${
id_running
:0:12
}
"
|
grep
"running"
|
grep
"
$container_name_running
"
[[
$?
-ne
0
]]
&&
msg_err
"
${
FUNCNAME
[0]
}
:
${
LINENO
}
- failed to stats running container"
&&
((
ret++
))
cat
$statslog
|
grep
"
${
id_pause
:0:12
}
"
|
grep
"paused"
|
grep
"
$container_name_pause
"
[[
$?
-ne
0
]]
&&
msg_err
"
${
FUNCNAME
[0]
}
:
${
LINENO
}
- failed to stats paused container"
&&
((
ret++
))
cat
$statslog
|
grep
"
${
id_stop
:0:12
}
"
[[
$?
-eq
0
]]
&&
msg_err
"
${
FUNCNAME
[0]
}
:
${
LINENO
}
- failed to stats exited container(should not)"
&&
((
ret++
))
isula stats
--original
-a
>
$statslog
[[
$?
-ne
0
]]
&&
msg_err
"
${
FUNCNAME
[0]
}
:
${
LINENO
}
- failed to stats
with option original
"
&&
((
ret++
))
[[
$?
-ne
0
]]
&&
msg_err
"
${
FUNCNAME
[0]
}
:
${
LINENO
}
- failed to stats
--original -a
"
&&
((
ret++
))
cat
$statslog
|
grep
"
${
id_init
:0:12
}
"
|
grep
"inited"
cat
$statslog
|
grep
"
${
id_init
:0:12
}
"
|
grep
"inited"
|
grep
"
$container_name_init
"
[[
$?
-ne
0
]]
&&
msg_err
"
${
FUNCNAME
[0]
}
:
${
LINENO
}
- failed to stats inited container"
&&
((
ret++
))
cat
$statslog
|
grep
"
${
id_running
:0:12
}
"
|
grep
"running"
cat
$statslog
|
grep
"
${
id_running
:0:12
}
"
|
grep
"running"
|
grep
"
$container_name_running
"
[[
$?
-ne
0
]]
&&
msg_err
"
${
FUNCNAME
[0]
}
:
${
LINENO
}
- failed to stats running container"
&&
((
ret++
))
cat
$statslog
|
grep
"
${
id_stop
:0:12
}
"
|
grep
"exited"
cat
$statslog
|
grep
"
${
id_pause
:0:12
}
"
|
grep
"paused"
|
grep
"
$container_name_pause
"
[[
$?
-ne
0
]]
&&
msg_err
"
${
FUNCNAME
[0]
}
:
${
LINENO
}
- failed to stats paused container"
&&
((
ret++
))
cat
$statslog
|
grep
"
${
id_stop
:0:12
}
"
|
grep
"exited"
|
grep
"
$container_name_stop
"
[[
$?
-ne
0
]]
&&
msg_err
"
${
FUNCNAME
[0]
}
:
${
LINENO
}
- failed to stats exited container"
&&
((
ret++
))
isula
rm
-f
"
$container_name_init
"
"
$container_name_running
"
"
$container_name_stop
"
isula unpause
$id_pause
[[
$?
-ne
0
]]
&&
msg_err
"
${
FUNCNAME
[0]
}
:
${
LINENO
}
- failed to unpause the paused container"
&&
((
ret++
))
isula
rm
-f
"
$container_name_init
"
"
$container_name_running
"
"
$container_name_pause
"
"
$container_name_stop
"
rm
-f
$statslog
...
...
src/api/services/containers/container.proto
浏览文件 @
9376ef4e
...
...
@@ -81,9 +81,10 @@ message Container_info {
uint64
mem_limit
=
11
;
uint64
kmem_used
=
12
;
uint64
kmem_limit
=
13
;
string
status
=
14
;
uint64
cache
=
15
;
uint64
cache_total
=
16
;
string
name
=
14
;
string
status
=
15
;
uint64
cache
=
16
;
uint64
cache_total
=
17
;
}
message
Event
{
...
...
src/client/connect/grpc/grpc_containers_client.cc
浏览文件 @
9376ef4e
...
...
@@ -1708,6 +1708,9 @@ public:
response
->
container_stats
[
i
].
mem_limit
=
gresponse
->
containers
(
i
).
mem_limit
();
response
->
container_stats
[
i
].
kmem_used
=
gresponse
->
containers
(
i
).
kmem_used
();
response
->
container_stats
[
i
].
kmem_limit
=
gresponse
->
containers
(
i
).
kmem_limit
();
if
(
!
gresponse
->
containers
(
i
).
name
().
empty
())
{
response
->
container_stats
[
i
].
name
=
util_strdup_s
(
gresponse
->
containers
(
i
).
name
().
c_str
());
}
if
(
!
gresponse
->
containers
(
i
).
status
().
empty
())
{
response
->
container_stats
[
i
].
status
=
util_strdup_s
(
gresponse
->
containers
(
i
).
status
().
c_str
());
}
...
...
src/client/libisula.c
浏览文件 @
9376ef4e
...
...
@@ -119,6 +119,8 @@ void isula_container_info_free(struct isula_container_info *info)
free
(
info
->
id
);
info
->
id
=
NULL
;
free
(
info
->
name
);
info
->
name
=
NULL
;
free
(
info
->
status
);
info
->
status
=
NULL
;
free
(
info
);
...
...
src/client/libisula.h
浏览文件 @
9376ef4e
...
...
@@ -331,6 +331,7 @@ struct isula_container_info {
uint64_t
kmem_used
;
uint64_t
kmem_limit
;
char
*
name
;
char
*
status
;
// Cache usage
uint64_t
cache
;
...
...
src/cmd/isula/extend/stats.c
浏览文件 @
9376ef4e
...
...
@@ -141,7 +141,7 @@ static void stats_print_original_data_header(void)
{
printf
(
"%-16s %-10s %-10s %-20s %-20s %-15s %-15s %-15s %-15s %-15s %-15s %-15s %-40s"
,
"ID"
,
"PIDS"
,
"Status"
,
"CpuUseNanos"
,
"CpuSystemUse"
,
"OnlineCpus"
,
"BlkioRead"
,
"BlkioWrite"
,
"MemUsed"
,
"MemLimit"
,
"KmemUsed"
,
"CacheUsage"
,
"NAME
S
"
);
"KmemUsed"
,
"CacheUsage"
,
"NAME"
);
printf
(
"
\n
"
);
}
...
...
@@ -158,7 +158,7 @@ static void stats_print_original_data(const struct isula_container_info *stats)
printf
(
"%-16s %-10llu %-10s %-20lu %-20lu %-15u %-15lu %-15lu %-15lu %-15lu %-15lu %-15lu %-40s"
,
short_id
,
(
unsigned
long
long
)
stats
->
pids_current
,
stats
->
status
,
stats
->
cpu_use_nanos
,
stats
->
cpu_system_use
,
stats
->
online_cpus
,
stats
->
blkio_read
,
stats
->
blkio_write
,
stats
->
mem_used
,
stats
->
mem_limit
,
stats
->
kmem_used
,
stats
->
cache
,
stats
->
id
);
stats
->
cache
,
stats
->
name
);
free
(
short_id
);
}
...
...
src/daemon/entry/connect/grpc/grpc_containers_service_private.cc
浏览文件 @
9376ef4e
...
...
@@ -789,6 +789,9 @@ int ContainerServiceImpl::stats_response_to_grpc(const container_stats_response
stats
->
set_mem_limit
(
response
->
container_stats
[
i
]
->
mem_limit
);
stats
->
set_kmem_used
(
response
->
container_stats
[
i
]
->
kmem_used
);
stats
->
set_kmem_limit
(
response
->
container_stats
[
i
]
->
kmem_limit
);
if
(
response
->
container_stats
[
i
]
->
name
!=
nullptr
)
{
stats
->
set_name
(
response
->
container_stats
[
i
]
->
name
);
}
if
(
response
->
container_stats
[
i
]
->
status
!=
nullptr
)
{
stats
->
set_status
(
response
->
container_stats
[
i
]
->
status
);
}
...
...
src/daemon/executor/container_cb/execution_extend.c
浏览文件 @
9376ef4e
...
...
@@ -264,6 +264,7 @@ static container_info *get_container_stats(const container_t *cont,
info
->
image_type
=
util_strdup_s
(
cont
->
common_config
->
image_type
);
info
->
name
=
util_strdup_s
(
cont
->
common_config
->
name
);
info
->
status
=
util_strdup_s
(
container_state_to_string
(
container_state_get_status
(
cont
->
state
)));
info
->
cache
=
einfo
->
cache
;
info
->
cache_total
=
einfo
->
cache_total
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录