Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
2f5560d3
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,发现更多精彩内容 >>
提交
2f5560d3
编写于
7月 04, 2013
作者:
M
Michal Privoznik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adapt to VIR_ALLOC and virAsprintf in src/xenapi/*
上级
d582618e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
10 addition
and
23 deletion
+10
-23
src/xenapi/xenapi_driver.c
src/xenapi/xenapi_driver.c
+5
-15
src/xenapi/xenapi_utils.c
src/xenapi/xenapi_utils.c
+5
-8
未找到文件。
src/xenapi/xenapi_driver.c
浏览文件 @
2f5560d3
...
...
@@ -77,10 +77,8 @@ getCapsObject(void)
virCapsGuestDomainPtr
domain1
,
domain2
;
virCapsPtr
caps
=
virCapabilitiesNew
(
virArchFromHost
(),
0
,
0
);
if
(
!
caps
)
{
virReportOOMError
();
if
(
!
caps
)
return
NULL
;
}
guest1
=
virCapabilitiesAddGuest
(
caps
,
"hvm"
,
VIR_ARCH_X86_64
,
""
,
""
,
0
,
NULL
);
if
(
!
guest1
)
goto
error_cleanup
;
...
...
@@ -155,15 +153,11 @@ xenapiConnectOpen(virConnectPtr conn, virConnectAuthPtr auth,
goto
error
;
}
if
(
VIR_ALLOC
(
privP
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC
(
privP
)
<
0
)
goto
error
;
}
if
(
virAsprintf
(
&
privP
->
url
,
"https://%s"
,
conn
->
uri
->
server
)
<
0
)
{
virReportOOMError
();
if
(
virAsprintf
(
&
privP
->
url
,
"https://%s"
,
conn
->
uri
->
server
)
<
0
)
goto
error
;
}
if
(
xenapiUtil_ParseQuery
(
conn
,
conn
->
uri
,
&
privP
->
noVerify
)
<
0
)
goto
error
;
...
...
@@ -1372,7 +1366,6 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
return
NULL
;
}
if
(
VIR_ALLOC
(
defPtr
)
<
0
)
{
virReportOOMError
();
xen_vm_set_free
(
vms
);
return
NULL
;
}
...
...
@@ -1502,12 +1495,12 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
defPtr
->
nnets
=
vif_set
->
size
;
if
(
VIR_ALLOC_N
(
defPtr
->
nets
,
vif_set
->
size
)
<
0
)
{
xen_vif_set_free
(
vif_set
);
goto
error
_cleanup
;
goto
error
;
}
for
(
i
=
0
;
i
<
vif_set
->
size
;
i
++
)
{
if
(
VIR_ALLOC
(
defPtr
->
nets
[
i
])
<
0
)
{
xen_vif_set_free
(
vif_set
);
goto
error
_cleanup
;
goto
error
;
}
defPtr
->
nets
[
i
]
->
type
=
VIR_DOMAIN_NET_TYPE_BRIDGE
;
vif
=
vif_set
->
contents
[
i
];
...
...
@@ -1534,13 +1527,10 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
virDomainDefFree
(
defPtr
);
return
xml
;
error_cleanup:
virReportOOMError
();
error:
xen_vm_set_free
(
vms
);
virDomainDefFree
(
defPtr
);
return
NULL
;
}
/*
...
...
src/xenapi/xenapi_utils.c
浏览文件 @
2f5560d3
...
...
@@ -347,10 +347,8 @@ allocStringMap(xen_string_string_map **strings, char *key, char *val)
int
sz
=
((
*
strings
)
==
NULL
)
?
0
:
(
*
strings
)
->
size
;
sz
++
;
if
(
VIR_REALLOC_N
(
*
strings
,
sizeof
(
xen_string_string_map
)
+
sizeof
(
xen_string_string_map_contents
)
*
sz
)
<
0
)
{
virReportOOMError
();
sizeof
(
xen_string_string_map_contents
)
*
sz
)
<
0
)
return
-
1
;
}
(
*
strings
)
->
size
=
sz
;
if
(
VIR_STRDUP
((
*
strings
)
->
contents
[
sz
-
1
].
key
,
key
)
<
0
||
VIR_STRDUP
((
*
strings
)
->
contents
[
sz
-
1
].
val
,
val
)
<
0
)
...
...
@@ -427,7 +425,7 @@ createVifNetwork(virConnectPtr conn, xen_vm vm, int device,
vif_record
->
other_config
=
xen_string_string_map_alloc
(
0
);
vif_record
->
runtime_properties
=
xen_string_string_map_alloc
(
0
);
vif_record
->
qos_algorithm_params
=
xen_string_string_map_alloc
(
0
);
if
(
virAsprintf
(
&
vif_record
->
device
,
"%d"
,
device
)
<
0
)
if
(
virAsprintf
Quiet
(
&
vif_record
->
device
,
"%d"
,
device
)
<
0
)
return
-
1
;
xen_vif_create
(
session
,
&
vif
,
vif_record
);
if
(
!
vif
)
{
...
...
@@ -545,22 +543,21 @@ createVMRecordFromXml(virConnectPtr conn, virDomainDefPtr def,
char
*
mac
;
if
(
VIR_ALLOC_N
(
mac
,
VIR_MAC_STRING_BUFLEN
)
<
0
)
goto
error
_cleanup
;
goto
error
;
virMacAddrFormat
(
&
def
->
nets
[
i
]
->
mac
,
mac
);
if
(
createVifNetwork
(
conn
,
*
vm
,
device_number
,
def
->
nets
[
i
]
->
data
.
bridge
.
brname
,
mac
)
<
0
)
{
VIR_FREE
(
mac
);
goto
error_cleanup
;
virReportOOMError
();
goto
error
;
}
device_number
++
;
}
}
return
0
;
error_cleanup:
virReportOOMError
();
error:
xen_vm_record_free
(
*
record
);
return
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录