Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
c7805f40
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看板
提交
c7805f40
编写于
1月 16, 2013
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
virsh: Use virTypedParams* APIs in node-memory-tune
上级
ec3e5064
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
53 deletion
+25
-53
tools/virsh-host.c
tools/virsh-host.c
+25
-53
未找到文件。
tools/virsh-host.c
浏览文件 @
c7805f40
...
...
@@ -796,42 +796,41 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd)
{
virTypedParameterPtr
params
=
NULL
;
int
nparams
=
0
;
int
maxparams
=
0
;
unsigned
int
flags
=
0
;
unsigned
int
shm_pages_to_scan
=
0
;
unsigned
int
shm_sleep_millisecs
=
0
;
unsigned
int
shm_merge_across_nodes
=
0
;
bool
has_shm_pages_to_scan
=
false
;
bool
has_shm_sleep_millisecs
=
false
;
bool
has_shm_merge_across_nodes
=
false
;
unsigned
int
value
;
bool
ret
=
false
;
int
rc
=
-
1
;
int
i
=
0
;
if
((
rc
=
vshCommandOptUInt
(
cmd
,
"shm-pages-to-scan"
,
&
shm_pages_to_scan
))
<
0
)
{
if
((
rc
=
vshCommandOptUInt
(
cmd
,
"shm-pages-to-scan"
,
&
value
))
<
0
)
{
vshError
(
ctl
,
"%s"
,
_
(
"invalid shm-pages-to-scan number"
));
return
false
;
goto
cleanup
;
}
else
if
(
rc
>
0
)
{
nparams
++
;
has_shm_pages_to_scan
=
true
;
if
(
virTypedParamsAddUInt
(
&
params
,
&
nparams
,
&
maxparams
,
VIR_NODE_MEMORY_SHARED_PAGES_TO_SCAN
,
value
)
<
0
)
goto
save_error
;
}
if
((
rc
=
vshCommandOptUInt
(
cmd
,
"shm-sleep-millisecs"
,
&
shm_sleep_millisecs
))
<
0
)
{
if
((
rc
=
vshCommandOptUInt
(
cmd
,
"shm-sleep-millisecs"
,
&
value
))
<
0
)
{
vshError
(
ctl
,
"%s"
,
_
(
"invalid shm-sleep-millisecs number"
));
return
false
;
goto
cleanup
;
}
else
if
(
rc
>
0
)
{
nparams
++
;
has_shm_sleep_millisecs
=
true
;
if
(
virTypedParamsAddUInt
(
&
params
,
&
nparams
,
&
maxparams
,
VIR_NODE_MEMORY_SHARED_SLEEP_MILLISECS
,
value
)
<
0
)
goto
save_error
;
}
if
((
rc
=
vshCommandOptUInt
(
cmd
,
"shm-merge-across-nodes"
,
&
shm_merge_across_nodes
))
<
0
)
{
if
((
rc
=
vshCommandOptUInt
(
cmd
,
"shm-merge-across-nodes"
,
&
value
))
<
0
)
{
vshError
(
ctl
,
"%s"
,
_
(
"invalid shm-merge-across-nodes number"
));
return
false
;
goto
cleanup
;
}
else
if
(
rc
>
0
)
{
nparams
++
;
has_shm_merge_across_nodes
=
true
;
if
(
virTypedParamsAddUInt
(
&
params
,
&
nparams
,
&
maxparams
,
VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES
,
value
)
<
0
)
goto
save_error
;
}
if
(
nparams
==
0
)
{
...
...
@@ -863,46 +862,19 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd)
vshPrint
(
ctl
,
"
\t
%-15s %s
\n
"
,
params
[
i
].
field
,
str
);
VIR_FREE
(
str
);
}
ret
=
true
;
}
else
{
/* Set the memory parameters */
params
=
vshCalloc
(
ctl
,
nparams
,
sizeof
(
*
params
));
if
(
i
<
nparams
&&
has_shm_pages_to_scan
)
{
if
(
virTypedParameterAssign
(
&
params
[
i
++
],
VIR_NODE_MEMORY_SHARED_PAGES_TO_SCAN
,
VIR_TYPED_PARAM_UINT
,
shm_pages_to_scan
)
<
0
)
goto
error
;
}
if
(
i
<
nparams
&&
has_shm_sleep_millisecs
)
{
if
(
virTypedParameterAssign
(
&
params
[
i
++
],
VIR_NODE_MEMORY_SHARED_SLEEP_MILLISECS
,
VIR_TYPED_PARAM_UINT
,
shm_sleep_millisecs
)
<
0
)
goto
error
;
}
if
(
i
<
nparams
&&
has_shm_merge_across_nodes
)
{
if
(
virTypedParameterAssign
(
&
params
[
i
++
],
VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES
,
VIR_TYPED_PARAM_UINT
,
shm_merge_across_nodes
)
<
0
)
goto
error
;
}
if
(
virNodeSetMemoryParameters
(
ctl
->
conn
,
params
,
nparams
,
flags
)
!=
0
)
goto
error
;
else
ret
=
true
;
}
ret
=
true
;
cleanup:
VIR_FREE
(
params
);
virTypedParamsFree
(
params
,
n
params
);
return
ret
;
save_error:
vshSaveLibvirtError
();
error:
vshError
(
ctl
,
"%s"
,
_
(
"Unable to change memory parameters"
));
goto
cleanup
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录