Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
13b9946e
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,发现更多精彩内容 >>
提交
13b9946e
编写于
2月 05, 2014
作者:
C
Cédric Bosdonnat
提交者:
Daniel P. Berrange
2月 12, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
LXC from native: migrate memory tuning
上级
99d8cddf
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
80 addition
and
0 deletion
+80
-0
src/lxc/lxc_native.c
src/lxc/lxc_native.c
+40
-0
tests/lxcconf2xmldata/lxcconf2xml-memtune.config
tests/lxcconf2xmldata/lxcconf2xml-memtune.config
+10
-0
tests/lxcconf2xmldata/lxcconf2xml-memtune.xml
tests/lxcconf2xmldata/lxcconf2xml-memtune.xml
+29
-0
tests/lxcconf2xmltest.c
tests/lxcconf2xmltest.c
+1
-0
未找到文件。
src/lxc/lxc_native.c
浏览文件 @
13b9946e
...
...
@@ -607,6 +607,42 @@ lxcIdmapWalkCallback(const char *name, virConfValuePtr value, void *data)
return
0
;
}
static
int
lxcSetMemTune
(
virDomainDefPtr
def
,
virConfPtr
properties
)
{
virConfValuePtr
value
;
unsigned
long
long
size
=
0
;
if
((
value
=
virConfGetValue
(
properties
,
"lxc.cgroup.memory.limit_in_bytes"
))
&&
value
->
str
&&
STRNEQ
(
value
->
str
,
"-1"
))
{
if
(
lxcConvertSize
(
value
->
str
,
&
size
)
<
0
)
return
-
1
;
size
=
size
/
1024
;
def
->
mem
.
max_balloon
=
size
;
def
->
mem
.
hard_limit
=
size
;
}
if
((
value
=
virConfGetValue
(
properties
,
"lxc.cgroup.memory.soft_limit_in_bytes"
))
&&
value
->
str
&&
STRNEQ
(
value
->
str
,
"-1"
))
{
if
(
lxcConvertSize
(
value
->
str
,
&
size
)
<
0
)
return
-
1
;
def
->
mem
.
soft_limit
=
size
/
1024
;
}
if
((
value
=
virConfGetValue
(
properties
,
"lxc.cgroup.memory.memsw.limit_in_bytes"
))
&&
value
->
str
&&
STRNEQ
(
value
->
str
,
"-1"
))
{
if
(
lxcConvertSize
(
value
->
str
,
&
size
)
<
0
)
return
-
1
;
def
->
mem
.
swap_hard_limit
=
size
/
1024
;
}
return
0
;
}
virDomainDefPtr
lxcParseConfigString
(
const
char
*
config
)
{
...
...
@@ -679,6 +715,10 @@ lxcParseConfigString(const char *config)
if
(
virConfWalk
(
properties
,
lxcIdmapWalkCallback
,
vmdef
)
<
0
)
goto
error
;
/* lxc.cgroup.memory.* */
if
(
lxcSetMemTune
(
vmdef
,
properties
)
<
0
)
goto
error
;
goto
cleanup
;
error:
...
...
tests/lxcconf2xmldata/lxcconf2xml-memtune.config
0 → 100644
浏览文件 @
13b9946e
lxc
.
rootfs
= /
var
/
lib
/
lxc
/
migrate_test
/
rootfs
lxc
.
utsname
=
migrate_test
lxc
.
autodev
=
1
# 1GiB
lxc
.
cgroup
.
memory
.
limit_in_bytes
=
1073741824
# 128MiB
lxc
.
cgroup
.
memory
.
soft_limit_in_bytes
=
134217728
# 2GiB
lxc
.
cgroup
.
memory
.
memsw
.
limit_in_bytes
=
2147483648
tests/lxcconf2xmldata/lxcconf2xml-memtune.xml
0 → 100644
浏览文件 @
13b9946e
<domain
type=
'lxc'
>
<name>
migrate_test
</name>
<uuid>
c7a5fdbd-edaf-9455-926a-d65c16db1809
</uuid>
<memory
unit=
'KiB'
>
1048576
</memory>
<currentMemory
unit=
'KiB'
>
0
</currentMemory>
<memtune>
<hard_limit
unit=
'KiB'
>
1048576
</hard_limit>
<soft_limit
unit=
'KiB'
>
131072
</soft_limit>
<swap_hard_limit
unit=
'KiB'
>
2097152
</swap_hard_limit>
</memtune>
<vcpu
placement=
'static'
current=
'0'
>
1
</vcpu>
<os>
<type>
exe
</type>
<init>
/sbin/init
</init>
</os>
<features>
<privnet/>
</features>
<clock
offset=
'utc'
/>
<on_poweroff>
destroy
</on_poweroff>
<on_reboot>
restart
</on_reboot>
<on_crash>
destroy
</on_crash>
<devices>
<filesystem
type=
'mount'
accessmode=
'passthrough'
>
<source
dir=
'/var/lib/lxc/migrate_test/rootfs'
/>
<target
dir=
'/'
/>
</filesystem>
</devices>
</domain>
tests/lxcconf2xmltest.c
浏览文件 @
13b9946e
...
...
@@ -109,6 +109,7 @@ mymain(void)
DO_TEST
(
"physnetwork"
,
false
);
DO_TEST
(
"macvlannetwork"
,
false
);
DO_TEST
(
"idmap"
,
false
);
DO_TEST
(
"memtune"
,
false
);
return
ret
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录