Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
2a3df5fa
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,发现更多精彩内容 >>
提交
2a3df5fa
编写于
9月 18, 2018
作者:
P
Pavel Hrdina
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vircgrouptest: prepare validateCgroup for cgroupv2
Signed-off-by:
N
Pavel Hrdina
<
phrdina@redhat.com
>
上级
1981c79c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
44 addition
and
9 deletion
+44
-9
tests/vircgrouptest.c
tests/vircgrouptest.c
+44
-9
未找到文件。
tests/vircgrouptest.c
浏览文件 @
2a3df5fa
...
...
@@ -43,7 +43,10 @@ static int validateCgroup(virCgroupPtr cgroup,
const
char
*
expectPath
,
const
char
**
expectMountPoint
,
const
char
**
expectLinkPoint
,
const
char
**
expectPlacement
)
const
char
**
expectPlacement
,
const
char
*
expectUnifiedMountPoint
,
const
char
*
expectUnifiedPlacement
,
unsigned
int
expectUnifiedControllers
)
{
size_t
i
;
...
...
@@ -80,6 +83,38 @@ static int validateCgroup(virCgroupPtr cgroup,
}
}
if
(
STRNEQ_NULLABLE
(
expectUnifiedMountPoint
,
cgroup
->
unified
.
mountPoint
))
{
fprintf
(
stderr
,
"Wrong mount '%s', expected '%s' for 'unified'
\n
"
,
cgroup
->
unified
.
mountPoint
,
expectUnifiedMountPoint
);
return
-
1
;
}
if
(
STRNEQ_NULLABLE
(
expectUnifiedPlacement
,
cgroup
->
unified
.
placement
))
{
fprintf
(
stderr
,
"Wrong placement '%s', expected '%s' for 'unified'
\n
"
,
cgroup
->
unified
.
placement
,
expectUnifiedPlacement
);
return
-
1
;
}
if
(
expectUnifiedControllers
!=
cgroup
->
unified
.
controllers
)
{
for
(
i
=
0
;
i
<
VIR_CGROUP_CONTROLLER_LAST
;
i
++
)
{
int
type
=
1
<<
i
;
if
((
expectUnifiedControllers
&
type
)
!=
(
cgroup
->
unified
.
controllers
&
type
))
{
const
char
*
typeStr
=
virCgroupControllerTypeToString
(
i
);
if
(
expectUnifiedControllers
&
type
)
{
fprintf
(
stderr
,
"expected controller '%s' for 'unified', "
"but it's missing
\n
"
,
typeStr
);
}
else
{
fprintf
(
stderr
,
"existing controller '%s' for 'unified', "
"but it's not expected
\n
"
,
typeStr
);
}
}
}
return
-
1
;
}
return
0
;
}
...
...
@@ -215,7 +250,7 @@ static int testCgroupNewForSelf(const void *args ATTRIBUTE_UNUSED)
goto
cleanup
;
}
ret
=
validateCgroup
(
cgroup
,
""
,
mountsFull
,
links
,
placement
);
ret
=
validateCgroup
(
cgroup
,
""
,
mountsFull
,
links
,
placement
,
NULL
,
NULL
,
0
);
cleanup:
virCgroupFree
(
&
cgroup
);
...
...
@@ -294,14 +329,14 @@ static int testCgroupNewForPartition(const void *args ATTRIBUTE_UNUSED)
fprintf
(
stderr
,
"Cannot create /virtualmachines cgroup: %d
\n
"
,
-
rv
);
goto
cleanup
;
}
ret
=
validateCgroup
(
cgroup
,
"/virtualmachines.partition"
,
mountsSmall
,
links
,
placementSmall
);
ret
=
validateCgroup
(
cgroup
,
"/virtualmachines.partition"
,
mountsSmall
,
links
,
placementSmall
,
NULL
,
NULL
,
0
);
virCgroupFree
(
&
cgroup
);
if
((
rv
=
virCgroupNewPartition
(
"/virtualmachines"
,
true
,
-
1
,
&
cgroup
))
!=
0
)
{
fprintf
(
stderr
,
"Cannot create /virtualmachines cgroup: %d
\n
"
,
-
rv
);
goto
cleanup
;
}
ret
=
validateCgroup
(
cgroup
,
"/virtualmachines.partition"
,
mountsFull
,
links
,
placementFull
);
ret
=
validateCgroup
(
cgroup
,
"/virtualmachines.partition"
,
mountsFull
,
links
,
placementFull
,
NULL
,
NULL
,
0
);
cleanup:
virCgroupFree
(
&
cgroup
);
...
...
@@ -351,7 +386,7 @@ static int testCgroupNewForPartitionNested(const void *args ATTRIBUTE_UNUSED)
}
ret
=
validateCgroup
(
cgroup
,
"/deployment.partition/production.partition"
,
mountsFull
,
links
,
placementFull
);
mountsFull
,
links
,
placementFull
,
NULL
,
NULL
,
0
);
cleanup:
virCgroupFree
(
&
cgroup
);
...
...
@@ -407,7 +442,7 @@ static int testCgroupNewForPartitionNestedDeep(const void *args ATTRIBUTE_UNUSED
}
ret
=
validateCgroup
(
cgroup
,
"/user/berrange.user/production.partition"
,
mountsFull
,
links
,
placementFull
);
mountsFull
,
links
,
placementFull
,
NULL
,
NULL
,
0
);
cleanup:
virCgroupFree
(
&
cgroup
);
...
...
@@ -443,7 +478,7 @@ static int testCgroupNewForPartitionDomain(const void *args ATTRIBUTE_UNUSED)
goto
cleanup
;
}
ret
=
validateCgroup
(
domaincgroup
,
"/production.partition/foo.libvirt-lxc"
,
mountsFull
,
links
,
placement
);
ret
=
validateCgroup
(
domaincgroup
,
"/production.partition/foo.libvirt-lxc"
,
mountsFull
,
links
,
placement
,
NULL
,
NULL
,
0
);
cleanup:
virCgroupFree
(
&
partitioncgroup
);
...
...
@@ -494,7 +529,7 @@ static int testCgroupNewForPartitionDomainEscaped(const void *args ATTRIBUTE_UNU
* since our fake /proc/cgroups pretends this controller
* isn't compiled into the kernel
*/
ret
=
validateCgroup
(
domaincgroup
,
"/_cgroup.evil/net_cls.evil/__evil.evil/_cpu.foo.libvirt-lxc"
,
mountsFull
,
links
,
placement
);
ret
=
validateCgroup
(
domaincgroup
,
"/_cgroup.evil/net_cls.evil/__evil.evil/_cpu.foo.libvirt-lxc"
,
mountsFull
,
links
,
placement
,
NULL
,
NULL
,
0
);
cleanup:
virCgroupFree
(
&
partitioncgroup3
);
...
...
@@ -523,7 +558,7 @@ static int testCgroupNewForSelfAllInOne(const void *args ATTRIBUTE_UNUSED)
goto
cleanup
;
}
ret
=
validateCgroup
(
cgroup
,
""
,
mountsAllInOne
,
linksAllInOne
,
placement
);
ret
=
validateCgroup
(
cgroup
,
""
,
mountsAllInOne
,
linksAllInOne
,
placement
,
NULL
,
NULL
,
0
);
cleanup:
virCgroupFree
(
&
cgroup
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录