Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
8485e5a2
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,发现更多精彩内容 >>
提交
8485e5a2
编写于
6月 07, 2011
作者:
H
Hu Tao
提交者:
Wen Congyang
6月 20, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update qemuDomainSetBlkioParameters to use flags
上级
100c39ca
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
89 addition
and
35 deletion
+89
-35
src/qemu/qemu_driver.c
src/qemu/qemu_driver.c
+89
-35
未找到文件。
src/qemu/qemu_driver.c
浏览文件 @
8485e5a2
...
@@ -4853,14 +4853,13 @@ static int qemuDomainSetBlkioParameters(virDomainPtr dom,
...
@@ -4853,14 +4853,13 @@ static int qemuDomainSetBlkioParameters(virDomainPtr dom,
int
i
;
int
i
;
virCgroupPtr
group
=
NULL
;
virCgroupPtr
group
=
NULL
;
virDomainObjPtr
vm
=
NULL
;
virDomainObjPtr
vm
=
NULL
;
virDomainDefPtr
persistentDef
=
NULL
;
int
ret
=
-
1
;
int
ret
=
-
1
;
bool
isActive
;
virCheckFlags
(
0
,
-
1
);
virCheckFlags
(
VIR_DOMAIN_AFFECT_LIVE
|
VIR_DOMAIN_AFFECT_CONFIG
,
-
1
);
qemuDriverLock
(
driver
);
qemuDriverLock
(
driver
);
if
(
!
qemuCgroupControllerActive
(
driver
,
VIR_CGROUP_CONTROLLER_BLKIO
))
{
qemuReportError
(
VIR_ERR_NO_SUPPORT
,
_
(
"blkio cgroup isn't mounted"
));
goto
cleanup
;
}
vm
=
virDomainFindByUUID
(
&
driver
->
domains
,
dom
->
uuid
);
vm
=
virDomainFindByUUID
(
&
driver
->
domains
,
dom
->
uuid
);
...
@@ -4870,19 +4869,46 @@ static int qemuDomainSetBlkioParameters(virDomainPtr dom,
...
@@ -4870,19 +4869,46 @@ static int qemuDomainSetBlkioParameters(virDomainPtr dom,
goto
cleanup
;
goto
cleanup
;
}
}
if
(
!
virDomainObjIsActive
(
vm
))
{
isActive
=
virDomainObjIsActive
(
vm
);
if
(
flags
==
VIR_DOMAIN_AFFECT_CURRENT
)
{
if
(
isActive
)
flags
=
VIR_DOMAIN_AFFECT_LIVE
;
else
flags
=
VIR_DOMAIN_AFFECT_CONFIG
;
}
if
(
flags
&
VIR_DOMAIN_AFFECT_LIVE
)
{
if
(
!
isActive
)
{
qemuReportError
(
VIR_ERR_OPERATION_INVALID
,
qemuReportError
(
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"domain is not running"
));
"%s"
,
_
(
"domain is not running"
));
goto
cleanup
;
goto
cleanup
;
}
}
if
(
!
qemuCgroupControllerActive
(
driver
,
VIR_CGROUP_CONTROLLER_BLKIO
))
{
qemuReportError
(
VIR_ERR_NO_SUPPORT
,
_
(
"blkio cgroup isn't mounted"
));
goto
cleanup
;
}
if
(
virCgroupForDomain
(
driver
->
cgroup
,
vm
->
def
->
name
,
&
group
,
0
)
!=
0
)
{
if
(
virCgroupForDomain
(
driver
->
cgroup
,
vm
->
def
->
name
,
&
group
,
0
)
!=
0
)
{
qemuReportError
(
VIR_ERR_INTERNAL_ERROR
,
qemuReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"cannot find cgroup for domain %s"
),
vm
->
def
->
name
);
_
(
"cannot find cgroup for domain %s"
),
vm
->
def
->
name
);
goto
cleanup
;
goto
cleanup
;
}
}
}
if
(
flags
&
VIR_DOMAIN_AFFECT_CONFIG
)
{
if
(
!
vm
->
persistent
)
{
qemuReportError
(
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"cannot change persistent config of a transient domain"
));
goto
cleanup
;
}
if
(
!
(
persistentDef
=
virDomainObjGetPersistentDef
(
driver
->
caps
,
vm
)))
goto
cleanup
;
}
ret
=
0
;
ret
=
0
;
if
(
flags
&
VIR_DOMAIN_AFFECT_LIVE
)
{
for
(
i
=
0
;
i
<
nparams
;
i
++
)
{
for
(
i
=
0
;
i
<
nparams
;
i
++
)
{
virTypedParameterPtr
param
=
&
params
[
i
];
virTypedParameterPtr
param
=
&
params
[
i
];
...
@@ -4914,6 +4940,34 @@ static int qemuDomainSetBlkioParameters(virDomainPtr dom,
...
@@ -4914,6 +4940,34 @@ static int qemuDomainSetBlkioParameters(virDomainPtr dom,
ret
=
-
1
;
ret
=
-
1
;
}
}
}
}
}
else
if
(
flags
&
VIR_DOMAIN_AFFECT_CONFIG
)
{
for
(
i
=
0
;
i
<
nparams
;
i
++
)
{
virTypedParameterPtr
param
=
&
params
[
i
];
if
(
STREQ
(
param
->
field
,
VIR_DOMAIN_BLKIO_WEIGHT
))
{
if
(
param
->
type
!=
VIR_TYPED_PARAM_UINT
)
{
qemuReportError
(
VIR_ERR_INVALID_ARG
,
"%s"
,
_
(
"invalid type for blkio weight tunable, expected a 'unsigned int'"
));
ret
=
-
1
;
continue
;
}
if
(
params
[
i
].
value
.
ui
>
1000
||
params
[
i
].
value
.
ui
<
100
)
{
qemuReportError
(
VIR_ERR_INVALID_ARG
,
"%s"
,
_
(
"out of blkio weight range."
));
ret
=
-
1
;
continue
;
}
persistentDef
->
blkio
.
weight
=
params
[
i
].
value
.
ui
;
}
else
{
qemuReportError
(
VIR_ERR_INVALID_ARG
,
_
(
"Parameter `%s' not supported"
),
param
->
field
);
ret
=
-
1
;
}
}
ret
=
virDomainSaveConfig
(
driver
->
configDir
,
persistentDef
);
}
cleanup:
cleanup:
virCgroupFree
(
&
group
);
virCgroupFree
(
&
group
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录