Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
1d241852
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,发现更多精彩内容 >>
提交
1d241852
编写于
8月 07, 2013
作者:
C
Cole Robinson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: Allow specifying domainsnapshot XML
The user can pass it as a <test:domainsnapshot> subelement of a <domain>.
上级
56ff156d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
97 addition
and
1 deletion
+97
-1
src/test/test_driver.c
src/test/test_driver.c
+97
-1
未找到文件。
src/test/test_driver.c
浏览文件 @
1d241852
...
...
@@ -162,12 +162,24 @@ struct _testDomainNamespaceDef {
int
runstate
;
bool
transient
;
bool
hasManagedSave
;
unsigned
int
num_snap_nodes
;
xmlNodePtr
*
snap_nodes
;
};
static
void
testDomainDefNamespaceFree
(
void
*
data
)
{
testDomainNamespaceDefPtr
nsdata
=
data
;
size_t
i
;
if
(
!
nsdata
)
return
;
for
(
i
=
0
;
i
<
nsdata
->
num_snap_nodes
;
i
++
)
xmlFreeNode
(
nsdata
->
snap_nodes
[
i
]);
VIR_FREE
(
nsdata
->
snap_nodes
);
VIR_FREE
(
nsdata
);
}
...
...
@@ -178,7 +190,9 @@ testDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_UNUSED,
void
**
data
)
{
testDomainNamespaceDefPtr
nsdata
=
NULL
;
int
tmp
;
xmlNodePtr
*
nodes
=
NULL
;
int
tmp
,
n
;
size_t
i
;
unsigned
int
tmpuint
;
if
(
xmlXPathRegisterNs
(
ctxt
,
BAD_CAST
"test"
,
...
...
@@ -192,6 +206,25 @@ testDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_UNUSED,
if
(
VIR_ALLOC
(
nsdata
)
<
0
)
return
-
1
;
n
=
virXPathNodeSet
(
"./test:domainsnapshot"
,
ctxt
,
&
nodes
);
if
(
n
<
0
)
goto
error
;
if
(
n
&&
VIR_ALLOC_N
(
nsdata
->
snap_nodes
,
n
)
<
0
)
goto
error
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
xmlNodePtr
newnode
=
xmlCopyNode
(
nodes
[
i
],
1
);
if
(
!
newnode
)
{
virReportOOMError
();
goto
error
;
}
nsdata
->
snap_nodes
[
nsdata
->
num_snap_nodes
]
=
newnode
;
nsdata
->
num_snap_nodes
++
;
}
VIR_FREE
(
nodes
);
tmp
=
virXPathBoolean
(
"boolean(./test:transient)"
,
ctxt
);
if
(
tmp
==
-
1
)
{
virReportError
(
VIR_ERR_XML_ERROR
,
"%s"
,
_
(
"invalid transient"
));
...
...
@@ -237,6 +270,7 @@ testDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_UNUSED,
return
0
;
error:
VIR_FREE
(
nodes
);
testDomainDefNamespaceFree
(
nsdata
);
return
-
1
;
}
...
...
@@ -932,6 +966,63 @@ error:
return
-
1
;
}
static
int
testParseDomainSnapshots
(
testConnPtr
privconn
,
virDomainObjPtr
domobj
,
const
char
*
file
,
xmlXPathContextPtr
ctxt
)
{
size_t
i
;
int
ret
=
-
1
;
testDomainNamespaceDefPtr
nsdata
=
domobj
->
def
->
namespaceData
;
xmlNodePtr
*
nodes
=
nsdata
->
snap_nodes
;
for
(
i
=
0
;
i
<
nsdata
->
num_snap_nodes
;
i
++
)
{
virDomainSnapshotObjPtr
snap
;
virDomainSnapshotDefPtr
def
;
xmlNodePtr
node
=
testParseXMLDocFromFile
(
nodes
[
i
],
file
,
"domainsnapshot"
);
if
(
!
node
)
goto
error
;
def
=
virDomainSnapshotDefParseNode
(
ctxt
->
doc
,
node
,
privconn
->
caps
,
privconn
->
xmlopt
,
1
<<
VIR_DOMAIN_VIRT_TEST
,
VIR_DOMAIN_SNAPSHOT_PARSE_DISKS
|
VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL
|
VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE
);
if
(
!
def
)
goto
error
;
if
(
!
(
snap
=
virDomainSnapshotAssignDef
(
domobj
->
snapshots
,
def
)))
{
virDomainSnapshotDefFree
(
def
);
goto
error
;
}
if
(
def
->
current
)
{
if
(
domobj
->
current_snapshot
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"more than one snapshot claims to be active"
));
goto
error
;
}
domobj
->
current_snapshot
=
snap
;
}
}
if
(
virDomainSnapshotUpdateRelations
(
domobj
->
snapshots
)
<
0
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Snapshots have inconsistent relations for "
"domain %s"
),
domobj
->
def
->
name
);
goto
error
;
}
ret
=
0
;
error:
return
ret
;
}
static
int
testParseDomains
(
testConnPtr
privconn
,
const
char
*
file
,
...
...
@@ -970,6 +1061,11 @@ testParseDomains(testConnPtr privconn,
goto
error
;
}
if
(
testParseDomainSnapshots
(
privconn
,
obj
,
file
,
ctxt
)
<
0
)
{
virObjectUnlock
(
obj
);
goto
error
;
}
nsdata
=
def
->
namespaceData
;
obj
->
persistent
=
!
nsdata
->
transient
;
obj
->
hasManagedSave
=
nsdata
->
hasManagedSave
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录