Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
64609328
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
64609328
编写于
6月 07, 2011
作者:
M
Minoru Usui
提交者:
Eric Blake
6月 14, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
virNodeGetMemoryStats: Implement virsh support
Signed-off-by:
N
Minoru Usui
<
usui@mxm.nes.nec.co.jp
>
上级
e047b404
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
70 addition
and
3 deletion
+70
-3
tools/virsh.c
tools/virsh.c
+65
-3
tools/virsh.pod
tools/virsh.pod
+5
-0
未找到文件。
tools/virsh.c
浏览文件 @
64609328
...
@@ -3718,7 +3718,7 @@ cmdNodeinfo(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
...
@@ -3718,7 +3718,7 @@ cmdNodeinfo(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
*/
*/
static
const
vshCmdInfo
info_nodecpustats
[]
=
{
static
const
vshCmdInfo
info_nodecpustats
[]
=
{
{
"help"
,
N_
(
"Prints cpu stats of the node."
)},
{
"help"
,
N_
(
"Prints cpu stats of the node."
)},
{
"desc"
,
N_
(
"Returns cpu stats of the node."
)},
{
"desc"
,
N_
(
"Returns cpu stats of the node
, in nanoseconds
."
)},
{
NULL
,
NULL
}
{
NULL
,
NULL
}
};
};
...
@@ -3729,7 +3729,7 @@ static const vshCmdOptDef opts_node_cpustats[] = {
...
@@ -3729,7 +3729,7 @@ static const vshCmdOptDef opts_node_cpustats[] = {
};
};
static
bool
static
bool
cmdNodeC
PUStats
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
ATTRIBUTE_UNUSED
)
cmdNodeC
puStats
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
)
{
{
int
i
,
j
;
int
i
,
j
;
bool
flag_utilization
=
false
;
bool
flag_utilization
=
false
;
...
@@ -3842,6 +3842,67 @@ cmdNodeCPUStats(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
...
@@ -3842,6 +3842,67 @@ cmdNodeCPUStats(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
return
ret
;
return
ret
;
}
}
/*
* "nodememstats" command
*/
static
const
vshCmdInfo
info_nodememstats
[]
=
{
{
"help"
,
N_
(
"Prints memory stats of the node."
)},
{
"desc"
,
N_
(
"Returns memory stats of the node, in kilobytes."
)},
{
NULL
,
NULL
}
};
static
const
vshCmdOptDef
opts_node_memstats
[]
=
{
{
"cell"
,
VSH_OT_INT
,
0
,
N_
(
"prints specified cell statistics only."
)},
{
NULL
,
0
,
0
,
NULL
}
};
static
bool
cmdNodeMemStats
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
)
{
int
nparams
=
0
;
unsigned
int
i
=
0
;
int
cellNum
=
VIR_MEMORY_STATS_ALL_CELLS
;
virMemoryStatsPtr
params
=
NULL
;
bool
ret
=
false
;
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
))
return
false
;
if
(
vshCommandOptInt
(
cmd
,
"cell"
,
&
cellNum
)
<
0
)
{
vshError
(
ctl
,
"%s"
,
_
(
"Invalid value of cellNum"
));
return
false
;
}
/* get the number of memory parameters */
if
(
virNodeGetMemoryStats
(
ctl
->
conn
,
cellNum
,
NULL
,
&
nparams
,
0
)
!=
0
)
{
vshError
(
ctl
,
"%s"
,
_
(
"Unable to get number of memory stats"
));
goto
cleanup
;
}
if
(
nparams
==
0
)
{
/* nothing to output */
ret
=
true
;
goto
cleanup
;
}
/* now go get all the memory parameters */
params
=
vshCalloc
(
ctl
,
nparams
,
sizeof
(
*
params
));
if
(
virNodeGetMemoryStats
(
ctl
->
conn
,
cellNum
,
params
,
&
nparams
,
0
)
!=
0
)
{
vshError
(
ctl
,
"%s"
,
_
(
"Unable to get memory stats"
));
goto
cleanup
;
}
for
(
i
=
0
;
i
<
nparams
;
i
++
)
vshPrint
(
ctl
,
"%-7s: %20llu kB
\n
"
,
params
[
i
].
field
,
params
[
i
].
value
);
ret
=
true
;
cleanup:
VIR_FREE
(
params
);
return
ret
;
}
/*
/*
* "capabilities" command
* "capabilities" command
*/
*/
...
@@ -11522,8 +11583,9 @@ static const vshCmdDef hostAndHypervisorCmds[] = {
...
@@ -11522,8 +11583,9 @@ static const vshCmdDef hostAndHypervisorCmds[] = {
VSH_CMD_FLAG_NOCONNECT
},
VSH_CMD_FLAG_NOCONNECT
},
{
"freecell"
,
cmdFreecell
,
opts_freecell
,
info_freecell
,
0
},
{
"freecell"
,
cmdFreecell
,
opts_freecell
,
info_freecell
,
0
},
{
"hostname"
,
cmdHostname
,
NULL
,
info_hostname
,
0
},
{
"hostname"
,
cmdHostname
,
NULL
,
info_hostname
,
0
},
{
"nodecpustats"
,
cmdNodeC
PU
Stats
,
opts_node_cpustats
,
info_nodecpustats
,
0
},
{
"nodecpustats"
,
cmdNodeC
pu
Stats
,
opts_node_cpustats
,
info_nodecpustats
,
0
},
{
"nodeinfo"
,
cmdNodeinfo
,
NULL
,
info_nodeinfo
,
0
},
{
"nodeinfo"
,
cmdNodeinfo
,
NULL
,
info_nodeinfo
,
0
},
{
"nodememstats"
,
cmdNodeMemStats
,
opts_node_memstats
,
info_nodememstats
,
0
},
{
"qemu-monitor-command"
,
cmdQemuMonitorCommand
,
opts_qemu_monitor_command
,
{
"qemu-monitor-command"
,
cmdQemuMonitorCommand
,
opts_qemu_monitor_command
,
info_qemu_monitor_command
,
0
},
info_qemu_monitor_command
,
0
},
{
"sysinfo"
,
cmdSysinfo
,
NULL
,
info_sysinfo
,
0
},
{
"sysinfo"
,
cmdSysinfo
,
NULL
,
info_sysinfo
,
0
},
...
...
tools/virsh.pod
浏览文件 @
64609328
...
@@ -246,6 +246,11 @@ If I<cpu> is specified, this will prints specified cpu statistics only.
...
@@ -246,6 +246,11 @@ If I<cpu> is specified, this will prints specified cpu statistics only.
If I<--percent> is specified, this will prints percentage of each kind of cpu
If I<--percent> is specified, this will prints percentage of each kind of cpu
statistics during 1 second.
statistics during 1 second.
=item B<nodememstats> optional I<cell>
Returns memory stats of the node.
If I<cell> is specified, this will prints specified cell statistics only.
=item B<capabilities>
=item B<capabilities>
Print an XML document describing the capabilities of the hypervisor
Print an XML document describing the capabilities of the hypervisor
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录