Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
3d58fa3f
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看板
提交
3d58fa3f
编写于
2月 05, 2014
作者:
C
Cédric Bosdonnat
提交者:
Daniel P. Berrange
2月 12, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
LXC from native: convert blkio throttle config
上级
f4b28d5c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
73 addition
and
19 deletion
+73
-19
src/lxc/lxc_native.c
src/lxc/lxc_native.c
+65
-19
tests/lxcconf2xmldata/lxcconf2xml-blkiotune.config
tests/lxcconf2xmldata/lxcconf2xml-blkiotune.config
+4
-0
tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml
tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml
+4
-0
未找到文件。
src/lxc/lxc_native.c
浏览文件 @
3d58fa3f
...
...
@@ -733,8 +733,12 @@ lxcBlkioDeviceWalkCallback(const char *name, virConfValuePtr value, void *data)
char
**
parts
=
NULL
;
virBlkioDevicePtr
device
=
NULL
;
virDomainDefPtr
def
=
data
;
size_t
i
=
0
;
char
*
path
=
NULL
;
int
ret
=
-
1
;
if
(
STRNEQ
(
name
,
"lxc.cgroup.blkio.device_weight"
)
||
!
value
->
str
)
if
(
!
STRPREFIX
(
name
,
"lxc.cgroup.blkio."
)
||
STREQ
(
name
,
"lxc.cgroup.blkio.weight"
)
||
!
value
->
str
)
return
0
;
if
(
!
(
parts
=
lxcStringSplit
(
value
->
str
)))
...
...
@@ -742,32 +746,74 @@ lxcBlkioDeviceWalkCallback(const char *name, virConfValuePtr value, void *data)
if
(
!
parts
[
0
]
||
!
parts
[
1
])
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"invalid
blkio.device_weight
value: '%s'"
),
value
->
str
);
goto
error
;
_
(
"invalid
%s
value: '%s'"
),
name
,
value
->
str
);
goto
cleanup
;
}
if
(
VIR_EXPAND_N
(
def
->
blkio
.
devices
,
def
->
blkio
.
ndevices
,
1
)
<
0
)
goto
error
;
device
=
&
def
->
blkio
.
devices
[
def
->
blkio
.
ndevices
-
1
];
if
(
virAsprintf
(
&
path
,
"/dev/block/%s"
,
parts
[
0
])
<
0
)
goto
cleanup
;
if
(
virAsprintf
(
&
device
->
path
,
"/dev/block/%s"
,
parts
[
0
])
<
0
)
goto
error
;
/* Do we already have a device definition for this path?
* Get that device or create a new one */
for
(
i
=
0
;
!
device
&&
i
<
def
->
blkio
.
ndevices
;
i
++
)
{
if
(
STREQ
(
def
->
blkio
.
devices
[
i
].
path
,
path
))
device
=
&
def
->
blkio
.
devices
[
i
];
}
if
(
!
device
)
{
if
(
VIR_EXPAND_N
(
def
->
blkio
.
devices
,
def
->
blkio
.
ndevices
,
1
)
<
0
)
goto
cleanup
;
device
=
&
def
->
blkio
.
devices
[
def
->
blkio
.
ndevices
-
1
];
device
->
path
=
path
;
path
=
NULL
;
}
if
(
virStrToLong_ui
(
parts
[
1
],
NULL
,
10
,
&
device
->
weight
)
<
0
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"failed to parse integer: '%s'"
),
parts
[
1
]);
goto
error
;
/* Set the value */
if
(
STREQ
(
name
,
"lxc.cgroup.blkio.device_weight"
))
{
if
(
virStrToLong_ui
(
parts
[
1
],
NULL
,
10
,
&
device
->
weight
)
<
0
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"failed to parse device weight: '%s'"
),
parts
[
1
]);
goto
cleanup
;
}
}
else
if
(
STREQ
(
name
,
"lxc.cgroup.blkio.throttle.read_bps_device"
))
{
if
(
virStrToLong_ull
(
parts
[
1
],
NULL
,
10
,
&
device
->
rbps
)
<
0
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"failed to parse read_bps_device: '%s'"
),
parts
[
1
]);
goto
cleanup
;
}
}
else
if
(
STREQ
(
name
,
"lxc.cgroup.blkio.throttle.write_bps_device"
))
{
if
(
virStrToLong_ull
(
parts
[
1
],
NULL
,
10
,
&
device
->
wbps
)
<
0
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"failed to parse write_bps_device: '%s'"
),
parts
[
1
]);
goto
cleanup
;
}
}
else
if
(
STREQ
(
name
,
"lxc.cgroup.blkio.throttle.read_iops_device"
))
{
if
(
virStrToLong_ui
(
parts
[
1
],
NULL
,
10
,
&
device
->
riops
)
<
0
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"failed to parse read_iops_device: '%s'"
),
parts
[
1
]);
goto
cleanup
;
}
}
else
if
(
STREQ
(
name
,
"lxc.cgroup.blkio.throttle.write_iops_device"
))
{
if
(
virStrToLong_ui
(
parts
[
1
],
NULL
,
10
,
&
device
->
wiops
)
<
0
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"failed to parse write_iops_device: '%s'"
),
parts
[
1
]);
goto
cleanup
;
}
}
else
{
VIR_WARN
(
"Unhandled blkio tune config: %s"
,
name
);
}
virStringFreeList
(
parts
)
;
ret
=
0
;
return
0
;
cleanup:
virStringFreeList
(
parts
);
VIR_FREE
(
path
);
error:
if
(
parts
)
virStringFreeList
(
parts
);
return
-
1
;
return
ret
;
}
static
int
...
...
tests/lxcconf2xmldata/lxcconf2xml-blkiotune.config
浏览文件 @
3d58fa3f
...
...
@@ -5,3 +5,7 @@ lxc.autodev=1
lxc
.
cgroup
.
blkio
.
weight
=
500
lxc
.
cgroup
.
blkio
.
device_weight
=
8
:
16
1000
lxc
.
cgroup
.
blkio
.
device_weight
=
8
:
0
300
lxc
.
cgroup
.
blkio
.
throttle
.
read_bps_device
=
8
:
16
1234
lxc
.
cgroup
.
blkio
.
throttle
.
write_bps_device
=
8
:
16
5678
lxc
.
cgroup
.
blkio
.
throttle
.
read_iops_device
=
8
:
16
4321
lxc
.
cgroup
.
blkio
.
throttle
.
write_iops_device
=
8
:
16
8765
tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml
浏览文件 @
3d58fa3f
...
...
@@ -8,6 +8,10 @@
<device>
<path>
/dev/block/8:16
</path>
<weight>
1000
</weight>
<read_iops_sec>
4321
</read_iops_sec>
<write_iops_sec>
8765
</write_iops_sec>
<read_bytes_sec>
1234
</read_bytes_sec>
<write_bytes_sec>
5678
</write_bytes_sec>
</device>
<device>
<path>
/dev/block/8:0
</path>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录