Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
5b8bfb02
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看板
提交
5b8bfb02
编写于
2月 05, 2014
作者:
C
Cédric Bosdonnat
提交者:
Daniel P. Berrange
2月 12, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
LXC from native: add lxc.cgroup.blkio.* mapping
上级
281e2990
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
109 addition
and
0 deletion
+109
-0
src/lxc/lxc_native.c
src/lxc/lxc_native.c
+66
-0
tests/lxcconf2xmldata/lxcconf2xml-blkiotune.config
tests/lxcconf2xmldata/lxcconf2xml-blkiotune.config
+7
-0
tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml
tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml
+35
-0
tests/lxcconf2xmltest.c
tests/lxcconf2xmltest.c
+1
-0
未找到文件。
src/lxc/lxc_native.c
浏览文件 @
5b8bfb02
...
...
@@ -699,6 +699,68 @@ lxcSetCpusetTune(virDomainDefPtr def, virConfPtr properties)
return
0
;
}
static
int
lxcBlkioDeviceWalkCallback
(
const
char
*
name
,
virConfValuePtr
value
,
void
*
data
)
{
char
**
parts
=
NULL
;
virBlkioDevicePtr
device
=
NULL
;
virDomainDefPtr
def
=
data
;
if
(
STRNEQ
(
name
,
"lxc.cgroup.blkio.device_weight"
)
||
!
value
->
str
)
return
0
;
if
(
!
(
parts
=
lxcStringSplit
(
value
->
str
)))
return
-
1
;
if
(
!
parts
[
0
]
||
!
parts
[
1
])
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"invalid blkio.device_weight value: '%s'"
),
value
->
str
);
goto
error
;
}
if
(
VIR_EXPAND_N
(
def
->
blkio
.
devices
,
def
->
blkio
.
ndevices
,
1
)
<
0
)
goto
error
;
device
=
&
def
->
blkio
.
devices
[
def
->
blkio
.
ndevices
-
1
];
if
(
virAsprintf
(
&
device
->
path
,
"/dev/block/%s"
,
parts
[
0
])
<
0
)
goto
error
;
if
(
virStrToLong_ui
(
parts
[
1
],
NULL
,
10
,
&
device
->
weight
)
<
0
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"failed to parse integer: '%s'"
),
parts
[
1
]);
goto
error
;
}
virStringFreeList
(
parts
);
return
0
;
error:
if
(
parts
)
virStringFreeList
(
parts
);
return
-
1
;
}
static
int
lxcSetBlkioTune
(
virDomainDefPtr
def
,
virConfPtr
properties
)
{
virConfValuePtr
value
;
if
((
value
=
virConfGetValue
(
properties
,
"lxc.cgroup.blkio.weight"
))
&&
value
->
str
&&
virStrToLong_ui
(
value
->
str
,
NULL
,
10
,
&
def
->
blkio
.
weight
)
<
0
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"failed to parse integer: '%s'"
),
value
->
str
);
return
-
1
;
}
if
(
virConfWalk
(
properties
,
lxcBlkioDeviceWalkCallback
,
def
)
<
0
)
return
-
1
;
return
0
;
}
virDomainDefPtr
lxcParseConfigString
(
const
char
*
config
)
{
...
...
@@ -783,6 +845,10 @@ lxcParseConfigString(const char *config)
if
(
lxcSetCpusetTune
(
vmdef
,
properties
)
<
0
)
goto
error
;
/* lxc.cgroup.blkio.* */
if
(
lxcSetBlkioTune
(
vmdef
,
properties
)
<
0
)
goto
error
;
goto
cleanup
;
error:
...
...
tests/lxcconf2xmldata/lxcconf2xml-blkiotune.config
0 → 100644
浏览文件 @
5b8bfb02
lxc
.
rootfs
= /
var
/
lib
/
lxc
/
migrate_test
/
rootfs
lxc
.
utsname
=
migrate_test
lxc
.
autodev
=
1
lxc
.
cgroup
.
blkio
.
weight
=
500
lxc
.
cgroup
.
blkio
.
device_weight
=
8
:
16
1000
lxc
.
cgroup
.
blkio
.
device_weight
=
8
:
0
300
tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml
0 → 100644
浏览文件 @
5b8bfb02
<domain
type=
'lxc'
>
<name>
migrate_test
</name>
<uuid>
c7a5fdbd-edaf-9455-926a-d65c16db1809
</uuid>
<memory
unit=
'KiB'
>
65536
</memory>
<currentMemory
unit=
'KiB'
>
0
</currentMemory>
<blkiotune>
<weight>
500
</weight>
<device>
<path>
/dev/block/8:16
</path>
<weight>
1000
</weight>
</device>
<device>
<path>
/dev/block/8:0
</path>
<weight>
300
</weight>
</device>
</blkiotune>
<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
浏览文件 @
5b8bfb02
...
...
@@ -112,6 +112,7 @@ mymain(void)
DO_TEST
(
"memtune"
,
false
);
DO_TEST
(
"cputune"
,
false
);
DO_TEST
(
"cpusettune"
,
false
);
DO_TEST
(
"blkiotune"
,
false
);
return
ret
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录