Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
23b861f5
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,发现更多精彩内容 >>
提交
23b861f5
编写于
7月 04, 2013
作者:
M
Michal Privoznik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adapt to VIR_ALLOC and virAsprintf in src/libxl/*
上级
d89f8056
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
50 deletion
+17
-50
src/libxl/libxl_conf.c
src/libxl/libxl_conf.c
+5
-13
src/libxl/libxl_driver.c
src/libxl/libxl_driver.c
+12
-37
未找到文件。
src/libxl/libxl_conf.c
浏览文件 @
23b861f5
...
...
@@ -278,12 +278,11 @@ libxlMakeCapabilitiesInternal(virArch hostarch,
host_pae
,
guest_archs
,
nr_guest_archs
))
==
NULL
)
goto
no_memory
;
goto
error
;
return
caps
;
no_memory:
virReportOOMError
();
error:
virObjectUnref
(
caps
);
return
NULL
;
}
...
...
@@ -576,10 +575,8 @@ libxlMakeDiskList(virDomainDefPtr def, libxl_domain_config *d_config)
libxl_device_disk
*
x_disks
;
int
i
;
if
(
VIR_ALLOC_N
(
x_disks
,
ndisks
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
x_disks
,
ndisks
)
<
0
)
return
-
1
;
}
for
(
i
=
0
;
i
<
ndisks
;
i
++
)
{
if
(
libxlMakeDisk
(
l_disks
[
i
],
&
x_disks
[
i
])
<
0
)
...
...
@@ -648,10 +645,8 @@ libxlMakeNicList(virDomainDefPtr def, libxl_domain_config *d_config)
libxl_device_nic
*
x_nics
;
int
i
;
if
(
VIR_ALLOC_N
(
x_nics
,
nnics
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
x_nics
,
nnics
)
<
0
)
return
-
1
;
}
for
(
i
=
0
;
i
<
nnics
;
i
++
)
{
if
(
libxlMakeNic
(
l_nics
[
i
],
&
x_nics
[
i
]))
...
...
@@ -734,12 +729,9 @@ libxlMakeVfbList(libxlDriverPrivatePtr driver,
if
(
nvfbs
==
0
)
return
0
;
if
(
VIR_ALLOC_N
(
x_vfbs
,
nvfbs
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
x_vfbs
,
nvfbs
)
<
0
)
return
-
1
;
}
if
(
VIR_ALLOC_N
(
x_vkbs
,
nvfbs
)
<
0
)
{
virReportOOMError
();
VIR_FREE
(
x_vfbs
);
return
-
1
;
}
...
...
src/libxl/libxl_driver.c
浏览文件 @
23b861f5
...
...
@@ -183,10 +183,8 @@ libxlFDRegisterEventHook(void *priv, int fd, void **hndp,
int
vir_events
=
VIR_EVENT_HANDLE_ERROR
;
libxlEventHookInfoPtr
info
;
if
(
VIR_ALLOC
(
info
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC
(
info
)
<
0
)
return
-
1
;
}
info
->
priv
=
priv
;
/*
...
...
@@ -287,10 +285,8 @@ libxlTimeoutRegisterEventHook(void *priv,
static
struct
timeval
zero
;
int
timeout
;
if
(
VIR_ALLOC
(
info
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC
(
info
)
<
0
)
return
-
1
;
}
info
->
priv
=
priv
;
/*
...
...
@@ -548,11 +544,7 @@ static char *
libxlDomainManagedSavePath
(
libxlDriverPrivatePtr
driver
,
virDomainObjPtr
vm
)
{
char
*
ret
;
if
(
virAsprintf
(
&
ret
,
"%s/%s.save"
,
driver
->
saveDir
,
vm
->
def
->
name
)
<
0
)
{
virReportOOMError
();
return
NULL
;
}
ignore_value
(
virAsprintf
(
&
ret
,
"%s/%s.save"
,
driver
->
saveDir
,
vm
->
def
->
name
));
return
ret
;
}
...
...
@@ -597,10 +589,8 @@ libxlSaveImageOpen(libxlDriverPrivatePtr driver, const char *from,
goto
error
;
}
if
(
VIR_ALLOC_N
(
xml
,
hdr
.
xmlLen
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
xml
,
hdr
.
xmlLen
)
<
0
)
goto
error
;
}
if
(
saferead
(
fd
,
xml
,
hdr
.
xmlLen
)
!=
hdr
.
xmlLen
)
{
virReportError
(
VIR_ERR_OPERATION_FAILED
,
"%s"
,
_
(
"failed to read XML"
));
...
...
@@ -845,10 +835,8 @@ libxlDomainSetVcpuAffinities(libxlDriverPrivatePtr driver, virDomainObjPtr vm)
if
(
vcpu
!=
def
->
cputune
.
vcpupin
[
vcpu
]
->
vcpuid
)
continue
;
if
(
VIR_ALLOC_N
(
cpumap
,
cpumaplen
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
cpumap
,
cpumaplen
)
<
0
)
goto
cleanup
;
}
cpumask
=
(
uint8_t
*
)
def
->
cputune
.
vcpupin
[
vcpu
]
->
cpumask
;
...
...
@@ -1273,9 +1261,8 @@ libxlStateInitialize(bool privileged,
goto
error
;
}
if
(
virAsprintf
(
&
log_file
,
"%s/libxl.log"
,
libxl_driver
->
logDir
)
<
0
)
{
goto
out_of_memory
;
}
if
(
virAsprintf
(
&
log_file
,
"%s/libxl.log"
,
libxl_driver
->
logDir
)
<
0
)
goto
error
;
if
((
libxl_driver
->
logger_file
=
fopen
(
log_file
,
"a"
))
==
NULL
)
{
virReportSystemError
(
errno
,
...
...
@@ -1369,8 +1356,6 @@ libxlStateInitialize(bool privileged,
return
0
;
out_of_memory:
virReportOOMError
();
error:
ret
=
-
1
;
fail:
...
...
@@ -2803,10 +2788,8 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
goto
cleanup
;
maplen
=
VIR_CPU_MAPLEN
(
nvcpus
);
if
(
VIR_ALLOC_N
(
bitmask
,
maplen
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
bitmask
,
maplen
)
<
0
)
goto
cleanup
;
}
for
(
i
=
0
;
i
<
nvcpus
;
++
i
)
{
pos
=
i
/
8
;
...
...
@@ -2967,10 +2950,8 @@ libxlDomainPinVcpu(virDomainPtr dom, unsigned int vcpu, unsigned char *cpumap,
}
if
(
!
vm
->
def
->
cputune
.
vcpupin
)
{
if
(
VIR_ALLOC
(
vm
->
def
->
cputune
.
vcpupin
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC
(
vm
->
def
->
cputune
.
vcpupin
)
<
0
)
goto
cleanup
;
}
vm
->
def
->
cputune
.
nvcpupin
=
0
;
}
if
(
virDomainVcpuPinAdd
(
&
vm
->
def
->
cputune
.
vcpupin
,
...
...
@@ -3176,10 +3157,8 @@ libxlConnectDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
if
(
!
(
conf
=
xenFormatXM
(
conn
,
def
,
ver_info
->
xen_version_major
)))
goto
cleanup
;
if
(
VIR_ALLOC_N
(
ret
,
len
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
ret
,
len
)
<
0
)
goto
cleanup
;
}
if
(
virConfWriteMem
(
ret
,
&
len
,
conf
)
<
0
)
{
VIR_FREE
(
ret
);
...
...
@@ -3492,10 +3471,8 @@ libxlDomainAttachDeviceDiskLive(libxlDomainObjPrivatePtr priv,
goto
cleanup
;
}
if
(
VIR_REALLOC_N
(
vm
->
def
->
disks
,
vm
->
def
->
ndisks
+
1
)
<
0
)
{
virReportOOMError
();
if
(
VIR_REALLOC_N
(
vm
->
def
->
disks
,
vm
->
def
->
ndisks
+
1
)
<
0
)
goto
cleanup
;
}
if
(
libxlMakeDisk
(
l_disk
,
&
x_disk
)
<
0
)
goto
cleanup
;
...
...
@@ -3617,10 +3594,8 @@ libxlDomainAttachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev)
_
(
"target %s already exists."
),
disk
->
dst
);
return
-
1
;
}
if
(
virDomainDiskInsert
(
vmdef
,
disk
))
{
virReportOOMError
();
if
(
virDomainDiskInsert
(
vmdef
,
disk
))
return
-
1
;
}
/* vmdef has the pointer. Generic codes for vmdef will do all jobs */
dev
->
data
.
disk
=
NULL
;
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录