Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
0571c3af
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看板
提交
0571c3af
编写于
5月 12, 2011
作者:
C
Cole Robinson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
xml: Make sure virXpathNodeSet always sets an error
And update callers to actually respect the error
上级
11d54887
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
26 addition
and
60 deletion
+26
-60
src/conf/domain_conf.c
src/conf/domain_conf.c
+0
-38
src/conf/interface_conf.c
src/conf/interface_conf.c
+11
-4
src/conf/network_conf.c
src/conf/network_conf.c
+3
-0
src/conf/node_device_conf.c
src/conf/node_device_conf.c
+5
-7
src/conf/storage_conf.c
src/conf/storage_conf.c
+3
-0
src/conf/storage_encryption_conf.c
src/conf/storage_encryption_conf.c
+0
-2
src/qemu/qemu_domain.c
src/qemu/qemu_domain.c
+0
-2
src/test/test_driver.c
src/test/test_driver.c
+0
-7
src/util/xml.c
src/util/xml.c
+4
-0
未找到文件。
src/conf/domain_conf.c
浏览文件 @
0571c3af
...
...
@@ -5228,8 +5228,6 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt,
/* analysis of the boot devices */
if
((
n
=
virXPathNodeSet
(
"./os/boot"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract boot device"
));
goto
cleanup
;
}
...
...
@@ -5517,8 +5515,6 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
def
->
cputune
.
shares
=
0
;
if
((
n
=
virXPathNodeSet
(
"./cputune/vcpupin"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract vcpupin nodes"
));
goto
error
;
}
...
...
@@ -5613,8 +5609,6 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
}
if
((
n
=
virXPathNodeSet
(
"./clock/timer"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"failed to parse timers"
));
goto
error
;
}
if
(
n
&&
VIR_ALLOC_N
(
def
->
clock
.
timers
,
n
)
<
0
)
...
...
@@ -5742,8 +5736,6 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
/* analysis of the disk devices */
if
((
n
=
virXPathNodeSet
(
"./devices/disk"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract disk devices"
));
goto
error
;
}
if
(
n
&&
VIR_ALLOC_N
(
def
->
disks
,
n
)
<
0
)
...
...
@@ -5762,8 +5754,6 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
/* analysis of the controller devices */
if
((
n
=
virXPathNodeSet
(
"./devices/controller"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract controller devices"
));
goto
error
;
}
if
(
n
&&
VIR_ALLOC_N
(
def
->
controllers
,
n
)
<
0
)
...
...
@@ -5780,8 +5770,6 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
/* analysis of the filesystems */
if
((
n
=
virXPathNodeSet
(
"./devices/filesystem"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract filesystem devices"
));
goto
error
;
}
if
(
n
&&
VIR_ALLOC_N
(
def
->
fss
,
n
)
<
0
)
...
...
@@ -5798,8 +5786,6 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
/* analysis of the network devices */
if
((
n
=
virXPathNodeSet
(
"./devices/interface"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract network devices"
));
goto
error
;
}
if
(
n
&&
VIR_ALLOC_N
(
def
->
nets
,
n
)
<
0
)
...
...
@@ -5820,8 +5806,6 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
/* analysis of the smartcard devices */
if
((
n
=
virXPathNodeSet
(
"./devices/smartcard"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract smartcard devices"
));
goto
error
;
}
if
(
n
&&
VIR_ALLOC_N
(
def
->
smartcards
,
n
)
<
0
)
...
...
@@ -5840,8 +5824,6 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
/* analysis of the character devices */
if
((
n
=
virXPathNodeSet
(
"./devices/parallel"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract parallel devices"
));
goto
error
;
}
if
(
n
&&
VIR_ALLOC_N
(
def
->
parallels
,
n
)
<
0
)
...
...
@@ -5868,8 +5850,6 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
VIR_FREE
(
nodes
);
if
((
n
=
virXPathNodeSet
(
"./devices/serial"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract serial devices"
));
goto
error
;
}
if
(
n
&&
VIR_ALLOC_N
(
def
->
serials
,
n
)
<
0
)
...
...
@@ -5926,8 +5906,6 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
}
if
((
n
=
virXPathNodeSet
(
"./devices/channel"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract channel devices"
));
goto
error
;
}
if
(
n
&&
VIR_ALLOC_N
(
def
->
channels
,
n
)
<
0
)
...
...
@@ -5967,8 +5945,6 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
/* analysis of the input devices */
if
((
n
=
virXPathNodeSet
(
"./devices/input"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract input devices"
));
goto
error
;
}
if
(
n
&&
VIR_ALLOC_N
(
def
->
inputs
,
n
)
<
0
)
...
...
@@ -6001,8 +5977,6 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
/* analysis of the graphics devices */
if
((
n
=
virXPathNodeSet
(
"./devices/graphics"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract graphics devices"
));
goto
error
;
}
if
(
n
&&
VIR_ALLOC_N
(
def
->
graphics
,
n
)
<
0
)
...
...
@@ -6044,8 +6018,6 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
/* analysis of the sound devices */
if
((
n
=
virXPathNodeSet
(
"./devices/sound"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract sound devices"
));
goto
error
;
}
if
(
n
&&
VIR_ALLOC_N
(
def
->
sounds
,
n
)
<
0
)
...
...
@@ -6062,8 +6034,6 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
/* analysis of the video devices */
if
((
n
=
virXPathNodeSet
(
"./devices/video"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract video devices"
));
goto
error
;
}
if
(
n
&&
VIR_ALLOC_N
(
def
->
videos
,
n
)
<
0
)
...
...
@@ -6102,8 +6072,6 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
/* analysis of the host devices */
if
((
n
=
virXPathNodeSet
(
"./devices/hostdev"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract host devices"
));
goto
error
;
}
if
(
n
&&
VIR_ALLOC_N
(
def
->
hostdevs
,
n
)
<
0
)
...
...
@@ -6122,8 +6090,6 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
/* analysis of the watchdog devices */
def
->
watchdog
=
NULL
;
if
((
n
=
virXPathNodeSet
(
"./devices/watchdog"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract watchdog devices"
));
goto
error
;
}
if
(
n
>
1
)
{
...
...
@@ -6144,8 +6110,6 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
/* analysis of the memballoon devices */
def
->
memballoon
=
NULL
;
if
((
n
=
virXPathNodeSet
(
"./devices/memballoon"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract memory balloon devices"
));
goto
error
;
}
if
(
n
>
1
)
{
...
...
@@ -6312,8 +6276,6 @@ static virDomainObjPtr virDomainObjParseXML(virCapsPtr caps,
obj
->
pid
=
(
pid_t
)
val
;
if
((
n
=
virXPathNodeSet
(
"./taint"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"failed to parse taint flags"
));
goto
error
;
}
for
(
i
=
0
;
i
<
n
;
i
++
)
{
...
...
src/conf/interface_conf.c
浏览文件 @
0571c3af
...
...
@@ -424,7 +424,10 @@ virInterfaceDefParseIfAdressing(virInterfaceDefPtr def,
save
=
ctxt
->
node
;
nProtoNodes
=
virXPathNodeSet
(
"./protocol"
,
ctxt
,
&
protoNodes
);
if
(
nProtoNodes
<=
0
)
{
if
(
nProtoNodes
<
0
)
goto
error
;
if
(
nProtoNodes
==
0
)
{
/* no protocols is an acceptable outcome */
return
0
;
}
...
...
@@ -495,8 +498,6 @@ virInterfaceDefParseBridge(virInterfaceDefPtr def,
bridge
=
ctxt
->
node
;
nbItf
=
virXPathNodeSet
(
"./interface"
,
ctxt
,
&
interfaces
);
if
(
nbItf
<
0
)
{
virInterfaceReportError
(
VIR_ERR_XML_ERROR
,
"%s"
,
_
(
"bridge interfaces"
));
ret
=
-
1
;
goto
error
;
}
...
...
@@ -536,12 +537,18 @@ virInterfaceDefParseBondItfs(virInterfaceDefPtr def,
int
ret
=
0
;
nbItf
=
virXPathNodeSet
(
"./interface"
,
ctxt
,
&
interfaces
);
if
(
nbItf
<=
0
)
{
if
(
nbItf
<
0
)
{
ret
=
-
1
;
goto
error
;
}
if
(
nbItf
==
0
)
{
virInterfaceReportError
(
VIR_ERR_XML_ERROR
,
"%s"
,
_
(
"bond has no interfaces"
));
ret
=
-
1
;
goto
error
;
}
if
(
VIR_ALLOC_N
(
def
->
data
.
bond
.
itf
,
nbItf
)
<
0
)
{
virReportOOMError
();
ret
=
-
1
;
...
...
src/conf/network_conf.c
浏览文件 @
0571c3af
...
...
@@ -642,6 +642,9 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
}
nIps
=
virXPathNodeSet
(
"./ip"
,
ctxt
,
&
ipNodes
);
if
(
nIps
<
0
)
goto
error
;
if
(
nIps
>
0
)
{
int
ii
;
...
...
src/conf/node_device_conf.c
浏览文件 @
0571c3af
...
...
@@ -570,9 +570,6 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt,
data
->
storage
.
serial
=
virXPathString
(
"string(./serial[1])"
,
ctxt
);
if
((
n
=
virXPathNodeSet
(
"./capability"
,
ctxt
,
&
nodes
))
<
0
)
{
virNodeDeviceReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"error parsing storage capabilities for '%s'"
),
def
->
name
);
goto
out
;
}
...
...
@@ -735,9 +732,6 @@ virNodeDevCapScsiHostParseXML(xmlXPathContextPtr ctxt,
}
if
((
n
=
virXPathNodeSet
(
"./capability"
,
ctxt
,
&
nodes
))
<
0
)
{
virNodeDeviceReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"error parsing SCSI host capabilities for '%s'"
),
def
->
name
);
goto
out
;
}
...
...
@@ -1170,7 +1164,11 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt, int create)
/* Parse device capabilities */
nodes
=
NULL
;
if
((
n
=
virXPathNodeSet
(
"./capability"
,
ctxt
,
&
nodes
))
<=
0
)
{
if
((
n
=
virXPathNodeSet
(
"./capability"
,
ctxt
,
&
nodes
))
<
0
)
{
goto
error
;
}
if
(
n
==
0
)
{
virNodeDeviceReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"no device capabilities for '%s'"
),
def
->
name
);
...
...
src/conf/storage_conf.c
浏览文件 @
0571c3af
...
...
@@ -438,6 +438,9 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
source
->
initiator
.
iqn
=
virXPathString
(
"string(./initiator/iqn/@name)"
,
ctxt
);
nsource
=
virXPathNodeSet
(
"./device"
,
ctxt
,
&
nodeset
);
if
(
nsource
<
0
)
goto
cleanup
;
if
(
nsource
>
0
)
{
if
(
VIR_ALLOC_N
(
source
->
devices
,
nsource
)
<
0
)
{
VIR_FREE
(
nodeset
);
...
...
src/conf/storage_encryption_conf.c
浏览文件 @
0571c3af
...
...
@@ -159,8 +159,6 @@ virStorageEncryptionParseXML(xmlXPathContextPtr ctxt)
n
=
virXPathNodeSet
(
"./secret"
,
ctxt
,
&
nodes
);
if
(
n
<
0
){
virStorageReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract volume encryption secrets"
));
goto
cleanup
;
}
if
(
n
!=
0
&&
VIR_ALLOC_N
(
ret
->
secrets
,
n
)
<
0
)
{
...
...
src/qemu/qemu_domain.c
浏览文件 @
0571c3af
...
...
@@ -351,7 +351,6 @@ qemuDomainDefNamespaceParse(xmlDocPtr xml,
/* first handle the extra command-line arguments */
n
=
virXPathNodeSet
(
"./qemu:commandline/qemu:arg"
,
ctxt
,
&
nodes
);
if
(
n
<
0
)
/* virXPathNodeSet already set the error */
goto
error
;
if
(
n
&&
VIR_ALLOC_N
(
cmd
->
args
,
n
)
<
0
)
...
...
@@ -372,7 +371,6 @@ qemuDomainDefNamespaceParse(xmlDocPtr xml,
/* now handle the extra environment variables */
n
=
virXPathNodeSet
(
"./qemu:commandline/qemu:env"
,
ctxt
,
&
nodes
);
if
(
n
<
0
)
/* virXPathNodeSet already set the error */
goto
error
;
if
(
n
&&
VIR_ALLOC_N
(
cmd
->
env_name
,
n
)
<
0
)
...
...
src/test/test_driver.c
浏览文件 @
0571c3af
...
...
@@ -681,8 +681,6 @@ static int testOpenVolumesForPool(xmlDocPtr xml,
ret
=
virXPathNodeSet
(
vol_xpath
,
ctxt
,
&
vols
);
VIR_FREE
(
vol_xpath
);
if
(
ret
<
0
)
{
testError
(
VIR_ERR_XML_ERROR
,
_
(
"node vol list for pool '%s'"
),
pool
->
def
->
name
);
goto
error
;
}
...
...
@@ -892,7 +890,6 @@ static int testOpenFromFile(virConnectPtr conn,
ret
=
virXPathNodeSet
(
"/node/domain"
,
ctxt
,
&
domains
);
if
(
ret
<
0
)
{
testError
(
VIR_ERR_XML_ERROR
,
"%s"
,
_
(
"node domain list"
));
goto
error
;
}
...
...
@@ -936,7 +933,6 @@ static int testOpenFromFile(virConnectPtr conn,
ret
=
virXPathNodeSet
(
"/node/network"
,
ctxt
,
&
networks
);
if
(
ret
<
0
)
{
testError
(
VIR_ERR_XML_ERROR
,
"%s"
,
_
(
"node network list"
));
goto
error
;
}
for
(
i
=
0
;
i
<
ret
;
i
++
)
{
...
...
@@ -972,7 +968,6 @@ static int testOpenFromFile(virConnectPtr conn,
/* Parse interface definitions */
ret
=
virXPathNodeSet
(
"/node/interface"
,
ctxt
,
&
ifaces
);
if
(
ret
<
0
)
{
testError
(
VIR_ERR_XML_ERROR
,
"%s"
,
_
(
"node interface list"
));
goto
error
;
}
for
(
i
=
0
;
i
<
ret
;
i
++
)
{
...
...
@@ -1008,7 +1003,6 @@ static int testOpenFromFile(virConnectPtr conn,
/* Parse Storage Pool list */
ret
=
virXPathNodeSet
(
"/node/pool"
,
ctxt
,
&
pools
);
if
(
ret
<
0
)
{
testError
(
VIR_ERR_XML_ERROR
,
"%s"
,
_
(
"node pool list"
));
goto
error
;
}
for
(
i
=
0
;
i
<
ret
;
i
++
)
{
...
...
@@ -1059,7 +1053,6 @@ static int testOpenFromFile(virConnectPtr conn,
ret
=
virXPathNodeSet
(
"/node/device"
,
ctxt
,
&
devs
);
if
(
ret
<
0
)
{
testError
(
VIR_ERR_XML_ERROR
,
"%s"
,
_
(
"node device list"
));
goto
error
;
}
for
(
i
=
0
;
i
<
ret
;
i
++
)
{
...
...
src/util/xml.c
浏览文件 @
0571c3af
...
...
@@ -601,10 +601,14 @@ virXPathNodeSet(const char *xpath,
ctxt
->
node
=
relnode
;
if
(
obj
==
NULL
)
return
(
0
);
if
(
obj
->
type
!=
XPATH_NODESET
)
{
virXMLError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Incorrect xpath '%s'"
),
xpath
);
xmlXPathFreeObject
(
obj
);
return
(
-
1
);
}
if
((
obj
->
nodesetval
==
NULL
)
||
(
obj
->
nodesetval
->
nodeNr
<
0
))
{
xmlXPathFreeObject
(
obj
);
return
(
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录