Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
bd60c16a
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看板
提交
bd60c16a
编写于
6月 27, 2016
作者:
C
Cole Robinson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: Move testOpenDefault definition later
Upcoming patches need this defined later
上级
4b8e07fc
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
136 addition
and
137 deletion
+136
-137
src/test/test_driver.c
src/test/test_driver.c
+136
-137
未找到文件。
src/test/test_driver.c
浏览文件 @
bd60c16a
...
...
@@ -615,143 +615,6 @@ testDomainStartState(testDriverPtr privconn,
}
/* Simultaneous test:///default connections should share the same
* common state (among other things, this allows testing event
* detection in one connection for an action caused in another). */
static
int
testOpenDefault
(
virConnectPtr
conn
)
{
int
u
;
testDriverPtr
privconn
=
NULL
;
virDomainDefPtr
domdef
=
NULL
;
virDomainObjPtr
domobj
=
NULL
;
virNetworkDefPtr
netdef
=
NULL
;
virNetworkObjPtr
netobj
=
NULL
;
virInterfaceDefPtr
interfacedef
=
NULL
;
virInterfaceObjPtr
interfaceobj
=
NULL
;
virStoragePoolDefPtr
pooldef
=
NULL
;
virStoragePoolObjPtr
poolobj
=
NULL
;
virNodeDeviceDefPtr
nodedef
=
NULL
;
virNodeDeviceObjPtr
nodeobj
=
NULL
;
virMutexLock
(
&
defaultLock
);
if
(
defaultConnections
++
)
{
conn
->
privateData
=
defaultConn
;
virMutexUnlock
(
&
defaultLock
);
return
VIR_DRV_OPEN_SUCCESS
;
}
if
(
!
(
privconn
=
testDriverNew
()))
goto
error
;
conn
->
privateData
=
privconn
;
memmove
(
&
privconn
->
nodeInfo
,
&
defaultNodeInfo
,
sizeof
(
defaultNodeInfo
));
/* Numa setup */
privconn
->
numCells
=
2
;
for
(
u
=
0
;
u
<
2
;
++
u
)
{
privconn
->
cells
[
u
].
numCpus
=
8
;
privconn
->
cells
[
u
].
mem
=
(
u
+
1
)
*
2048
*
1024
;
}
for
(
u
=
0
;
u
<
16
;
u
++
)
{
virBitmapPtr
siblings
=
virBitmapNew
(
16
);
if
(
!
siblings
)
goto
error
;
ignore_value
(
virBitmapSetBit
(
siblings
,
u
));
privconn
->
cells
[
u
/
8
].
cpus
[(
u
%
8
)].
id
=
u
;
privconn
->
cells
[
u
/
8
].
cpus
[(
u
%
8
)].
socket_id
=
u
/
8
;
privconn
->
cells
[
u
/
8
].
cpus
[(
u
%
8
)].
core_id
=
u
%
8
;
privconn
->
cells
[
u
/
8
].
cpus
[(
u
%
8
)].
siblings
=
siblings
;
}
if
(
!
(
privconn
->
caps
=
testBuildCapabilities
(
conn
)))
goto
error
;
if
(
!
(
domdef
=
virDomainDefParseString
(
defaultDomainXML
,
privconn
->
caps
,
privconn
->
xmlopt
,
VIR_DOMAIN_DEF_PARSE_INACTIVE
)))
goto
error
;
if
(
testDomainGenerateIfnames
(
domdef
)
<
0
)
goto
error
;
if
(
!
(
domobj
=
virDomainObjListAdd
(
privconn
->
domains
,
domdef
,
privconn
->
xmlopt
,
0
,
NULL
)))
goto
error
;
domdef
=
NULL
;
domobj
->
persistent
=
1
;
if
(
testDomainStartState
(
privconn
,
domobj
,
VIR_DOMAIN_RUNNING_BOOTED
)
<
0
)
{
virObjectUnlock
(
domobj
);
goto
error
;
}
virObjectUnlock
(
domobj
);
if
(
!
(
netdef
=
virNetworkDefParseString
(
defaultNetworkXML
)))
goto
error
;
if
(
!
(
netobj
=
virNetworkAssignDef
(
privconn
->
networks
,
netdef
,
0
)))
{
virNetworkDefFree
(
netdef
);
goto
error
;
}
netobj
->
active
=
1
;
virNetworkObjEndAPI
(
&
netobj
);
if
(
!
(
interfacedef
=
virInterfaceDefParseString
(
defaultInterfaceXML
)))
goto
error
;
if
(
!
(
interfaceobj
=
virInterfaceAssignDef
(
&
privconn
->
ifaces
,
interfacedef
)))
{
virInterfaceDefFree
(
interfacedef
);
goto
error
;
}
interfaceobj
->
active
=
1
;
virInterfaceObjUnlock
(
interfaceobj
);
if
(
!
(
pooldef
=
virStoragePoolDefParseString
(
defaultPoolXML
)))
goto
error
;
if
(
!
(
poolobj
=
virStoragePoolObjAssignDef
(
&
privconn
->
pools
,
pooldef
)))
{
virStoragePoolDefFree
(
pooldef
);
goto
error
;
}
if
(
testStoragePoolObjSetDefaults
(
poolobj
)
==
-
1
)
{
virStoragePoolObjUnlock
(
poolobj
);
goto
error
;
}
poolobj
->
active
=
1
;
virStoragePoolObjUnlock
(
poolobj
);
/* Init default node device */
if
(
!
(
nodedef
=
virNodeDeviceDefParseString
(
defaultNodeXML
,
0
,
NULL
)))
goto
error
;
if
(
!
(
nodeobj
=
virNodeDeviceAssignDef
(
&
privconn
->
devs
,
nodedef
)))
{
virNodeDeviceDefFree
(
nodedef
);
goto
error
;
}
virNodeDeviceObjUnlock
(
nodeobj
);
defaultConn
=
privconn
;
virMutexUnlock
(
&
defaultLock
);
return
VIR_DRV_OPEN_SUCCESS
;
error:
testDriverFree
(
privconn
);
conn
->
privateData
=
NULL
;
virDomainDefFree
(
domdef
);
defaultConnections
--
;
virMutexUnlock
(
&
defaultLock
);
return
VIR_DRV_OPEN_ERROR
;
}
static
char
*
testBuildFilename
(
const
char
*
relativeTo
,
const
char
*
filename
)
{
...
...
@@ -1368,6 +1231,142 @@ testOpenFromFile(virConnectPtr conn, const char *file)
return
VIR_DRV_OPEN_ERROR
;
}
/* Simultaneous test:///default connections should share the same
* common state (among other things, this allows testing event
* detection in one connection for an action caused in another). */
static
int
testOpenDefault
(
virConnectPtr
conn
)
{
int
u
;
testDriverPtr
privconn
=
NULL
;
virDomainDefPtr
domdef
=
NULL
;
virDomainObjPtr
domobj
=
NULL
;
virNetworkDefPtr
netdef
=
NULL
;
virNetworkObjPtr
netobj
=
NULL
;
virInterfaceDefPtr
interfacedef
=
NULL
;
virInterfaceObjPtr
interfaceobj
=
NULL
;
virStoragePoolDefPtr
pooldef
=
NULL
;
virStoragePoolObjPtr
poolobj
=
NULL
;
virNodeDeviceDefPtr
nodedef
=
NULL
;
virNodeDeviceObjPtr
nodeobj
=
NULL
;
virMutexLock
(
&
defaultLock
);
if
(
defaultConnections
++
)
{
conn
->
privateData
=
defaultConn
;
virMutexUnlock
(
&
defaultLock
);
return
VIR_DRV_OPEN_SUCCESS
;
}
if
(
!
(
privconn
=
testDriverNew
()))
goto
error
;
conn
->
privateData
=
privconn
;
memmove
(
&
privconn
->
nodeInfo
,
&
defaultNodeInfo
,
sizeof
(
defaultNodeInfo
));
/* Numa setup */
privconn
->
numCells
=
2
;
for
(
u
=
0
;
u
<
2
;
++
u
)
{
privconn
->
cells
[
u
].
numCpus
=
8
;
privconn
->
cells
[
u
].
mem
=
(
u
+
1
)
*
2048
*
1024
;
}
for
(
u
=
0
;
u
<
16
;
u
++
)
{
virBitmapPtr
siblings
=
virBitmapNew
(
16
);
if
(
!
siblings
)
goto
error
;
ignore_value
(
virBitmapSetBit
(
siblings
,
u
));
privconn
->
cells
[
u
/
8
].
cpus
[(
u
%
8
)].
id
=
u
;
privconn
->
cells
[
u
/
8
].
cpus
[(
u
%
8
)].
socket_id
=
u
/
8
;
privconn
->
cells
[
u
/
8
].
cpus
[(
u
%
8
)].
core_id
=
u
%
8
;
privconn
->
cells
[
u
/
8
].
cpus
[(
u
%
8
)].
siblings
=
siblings
;
}
if
(
!
(
privconn
->
caps
=
testBuildCapabilities
(
conn
)))
goto
error
;
if
(
!
(
domdef
=
virDomainDefParseString
(
defaultDomainXML
,
privconn
->
caps
,
privconn
->
xmlopt
,
VIR_DOMAIN_DEF_PARSE_INACTIVE
)))
goto
error
;
if
(
testDomainGenerateIfnames
(
domdef
)
<
0
)
goto
error
;
if
(
!
(
domobj
=
virDomainObjListAdd
(
privconn
->
domains
,
domdef
,
privconn
->
xmlopt
,
0
,
NULL
)))
goto
error
;
domdef
=
NULL
;
domobj
->
persistent
=
1
;
if
(
testDomainStartState
(
privconn
,
domobj
,
VIR_DOMAIN_RUNNING_BOOTED
)
<
0
)
{
virObjectUnlock
(
domobj
);
goto
error
;
}
virObjectUnlock
(
domobj
);
if
(
!
(
netdef
=
virNetworkDefParseString
(
defaultNetworkXML
)))
goto
error
;
if
(
!
(
netobj
=
virNetworkAssignDef
(
privconn
->
networks
,
netdef
,
0
)))
{
virNetworkDefFree
(
netdef
);
goto
error
;
}
netobj
->
active
=
1
;
virNetworkObjEndAPI
(
&
netobj
);
if
(
!
(
interfacedef
=
virInterfaceDefParseString
(
defaultInterfaceXML
)))
goto
error
;
if
(
!
(
interfaceobj
=
virInterfaceAssignDef
(
&
privconn
->
ifaces
,
interfacedef
)))
{
virInterfaceDefFree
(
interfacedef
);
goto
error
;
}
interfaceobj
->
active
=
1
;
virInterfaceObjUnlock
(
interfaceobj
);
if
(
!
(
pooldef
=
virStoragePoolDefParseString
(
defaultPoolXML
)))
goto
error
;
if
(
!
(
poolobj
=
virStoragePoolObjAssignDef
(
&
privconn
->
pools
,
pooldef
)))
{
virStoragePoolDefFree
(
pooldef
);
goto
error
;
}
if
(
testStoragePoolObjSetDefaults
(
poolobj
)
==
-
1
)
{
virStoragePoolObjUnlock
(
poolobj
);
goto
error
;
}
poolobj
->
active
=
1
;
virStoragePoolObjUnlock
(
poolobj
);
/* Init default node device */
if
(
!
(
nodedef
=
virNodeDeviceDefParseString
(
defaultNodeXML
,
0
,
NULL
)))
goto
error
;
if
(
!
(
nodeobj
=
virNodeDeviceAssignDef
(
&
privconn
->
devs
,
nodedef
)))
{
virNodeDeviceDefFree
(
nodedef
);
goto
error
;
}
virNodeDeviceObjUnlock
(
nodeobj
);
defaultConn
=
privconn
;
virMutexUnlock
(
&
defaultLock
);
return
VIR_DRV_OPEN_SUCCESS
;
error:
testDriverFree
(
privconn
);
conn
->
privateData
=
NULL
;
virDomainDefFree
(
domdef
);
defaultConnections
--
;
virMutexUnlock
(
&
defaultLock
);
return
VIR_DRV_OPEN_ERROR
;
}
static
int
testConnectAuthenticate
(
virConnectPtr
conn
,
virConnectAuthPtr
auth
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录