Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
39c7e7a6
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看板
提交
39c7e7a6
编写于
6月 29, 2009
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix crash in QEMU driver with bad capabilities data
上级
609e31dd
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
88 addition
and
31 deletion
+88
-31
ChangeLog
ChangeLog
+11
-0
src/capabilities.c
src/capabilities.c
+11
-3
src/capabilities.h
src/capabilities.h
+3
-0
src/libvirt_private.syms
src/libvirt_private.syms
+1
-0
src/qemu_conf.c
src/qemu_conf.c
+8
-2
src/qemu_driver.c
src/qemu_driver.c
+54
-26
未找到文件。
ChangeLog
浏览文件 @
39c7e7a6
Mon Jun 29 10:51:20 BST 2009 Daniel P. Berrange <berrange@redhat.com>
Fix crash in QEMU driver with bad capabilities data
* src/capabilities.c, src/capabilities.h: Export a method
virCapabilitiesFreeNUMAInfo()
* src/qemu_conf.c: Don't kill the whole QEMU driver if
populating capabilities with NUMA info fails.
* src/qemu_driver.c: Fix missing security model data
after capabilities refresh. Avoid leaving driver with
NULL capabilities if refresh fails.
Fri Jun 26 22:13:16 CEST 2009 Daniel Veillard <veillard@redhat.com>
* src/parthelper.c: fix a superfluous % on printf format problem
...
...
src/capabilities.c
浏览文件 @
39c7e7a6
...
...
@@ -121,6 +121,15 @@ virCapabilitiesFreeGuest(virCapsGuestPtr guest)
VIR_FREE
(
guest
);
}
void
virCapabilitiesFreeNUMAInfo
(
virCapsPtr
caps
)
{
int
i
;
for
(
i
=
0
;
i
<
caps
->
host
.
nnumaCell
;
i
++
)
virCapabilitiesFreeHostNUMACell
(
caps
->
host
.
numaCell
[
i
]);
VIR_FREE
(
caps
->
host
.
numaCell
);
}
/**
* virCapabilitiesFree:
...
...
@@ -141,9 +150,8 @@ virCapabilitiesFree(virCapsPtr caps) {
for
(
i
=
0
;
i
<
caps
->
host
.
nfeatures
;
i
++
)
VIR_FREE
(
caps
->
host
.
features
[
i
]);
VIR_FREE
(
caps
->
host
.
features
);
for
(
i
=
0
;
i
<
caps
->
host
.
nnumaCell
;
i
++
)
virCapabilitiesFreeHostNUMACell
(
caps
->
host
.
numaCell
[
i
]);
VIR_FREE
(
caps
->
host
.
numaCell
);
virCapabilitiesFreeNUMAInfo
(
caps
);
for
(
i
=
0
;
i
<
caps
->
host
.
nmigrateTrans
;
i
++
)
VIR_FREE
(
caps
->
host
.
migrateTrans
[
i
]);
...
...
src/capabilities.h
浏览文件 @
39c7e7a6
...
...
@@ -118,6 +118,9 @@ virCapabilitiesNew(const char *arch,
extern
void
virCapabilitiesFree
(
virCapsPtr
caps
);
extern
void
virCapabilitiesFreeNUMAInfo
(
virCapsPtr
caps
);
extern
void
virCapabilitiesSetMacPrefix
(
virCapsPtr
caps
,
unsigned
char
*
prefix
);
...
...
src/libvirt_private.syms
浏览文件 @
39c7e7a6
...
...
@@ -24,6 +24,7 @@ virCapabilitiesDefaultGuestEmulator;
virCapabilitiesDefaultGuestMachine;
virCapabilitiesFormatXML;
virCapabilitiesFree;
virCapabilitiesFreeNUMAInfo;
virCapabilitiesNew;
virCapabilitiesSetMacPrefix;
virCapabilitiesGenerateMac;
...
...
src/qemu_conf.c
浏览文件 @
39c7e7a6
...
...
@@ -377,8 +377,14 @@ virCapsPtr qemudCapsInit(void) {
/* Using KVM's mac prefix for QEMU too */
virCapabilitiesSetMacPrefix
(
caps
,
(
unsigned
char
[]){
0x52
,
0x54
,
0x00
});
if
(
nodeCapsInitNUMA
(
caps
)
<
0
)
goto
no_memory
;
/* Some machines have problematic NUMA toplogy causing
* unexpected failures. We don't want to break the QEMU
* driver in this scenario, so log errors & carry on
*/
if
(
nodeCapsInitNUMA
(
caps
)
<
0
)
{
virCapabilitiesFreeNUMAInfo
(
caps
);
VIR_WARN0
(
"Failed to query host NUMA topology, disabling NUMA capabilities"
);
}
virCapabilitiesAddHostMigrateTransport
(
caps
,
"tcp"
);
...
...
src/qemu_driver.c
浏览文件 @
39c7e7a6
...
...
@@ -347,12 +347,43 @@ qemuReconnectDomains(struct qemud_driver *driver)
}
}
static
int
qemudSecurityCapsInit
(
virSecurityDriverPtr
secdrv
,
virCapsPtr
caps
)
{
const
char
*
doi
,
*
model
;
doi
=
virSecurityDriverGetDOI
(
secdrv
);
model
=
virSecurityDriverGetModel
(
secdrv
);
caps
->
host
.
secModel
.
model
=
strdup
(
model
);
if
(
!
caps
->
host
.
secModel
.
model
)
{
char
ebuf
[
1024
];
VIR_ERROR
(
_
(
"Failed to copy secModel model: %s"
),
virStrerror
(
errno
,
ebuf
,
sizeof
ebuf
));
return
-
1
;
}
caps
->
host
.
secModel
.
doi
=
strdup
(
doi
);
if
(
!
caps
->
host
.
secModel
.
doi
)
{
char
ebuf
[
1024
];
VIR_ERROR
(
_
(
"Failed to copy secModel DOI: %s"
),
virStrerror
(
errno
,
ebuf
,
sizeof
ebuf
));
return
-
1
;
}
VIR_DEBUG
(
"Initialized caps for security driver
\"
%s
\"
with "
"DOI
\"
%s
\"
"
,
model
,
doi
);
return
0
;
}
static
int
qemudSecurityInit
(
struct
qemud_driver
*
qemud_drv
)
{
int
ret
;
const
char
*
doi
,
*
model
;
virCapsPtr
caps
;
virSecurityDriverPtr
security_drv
;
ret
=
virSecurityDriverStartup
(
&
security_drv
,
...
...
@@ -368,36 +399,17 @@ qemudSecurityInit(struct qemud_driver *qemud_drv)
}
qemud_drv
->
securityDriver
=
security_drv
;
doi
=
virSecurityDriverGetDOI
(
security_drv
);
model
=
virSecurityDriverGetModel
(
security_drv
);
VIR_DEBUG
(
"Initialized security driver
\"
%s
\"
with "
"DOI
\"
%s
\"
"
,
model
,
doi
);
VIR_INFO
(
"Initialized security driver %s"
,
security_drv
->
name
);
/*
* Add security policy host caps now that the security driver is
* initialized.
*/
caps
=
qemud_drv
->
caps
;
caps
->
host
.
secModel
.
model
=
strdup
(
model
);
if
(
!
caps
->
host
.
secModel
.
model
)
{
char
ebuf
[
1024
];
VIR_ERROR
(
_
(
"Failed to copy secModel model: %s"
),
virStrerror
(
errno
,
ebuf
,
sizeof
ebuf
));
return
-
1
;
}
return
qemudSecurityCapsInit
(
security_drv
,
qemud_drv
->
caps
);
}
caps
->
host
.
secModel
.
doi
=
strdup
(
doi
);
if
(
!
caps
->
host
.
secModel
.
doi
)
{
char
ebuf
[
1024
];
VIR_ERROR
(
_
(
"Failed to copy secModel DOI: %s"
),
virStrerror
(
errno
,
ebuf
,
sizeof
ebuf
));
return
-
1
;
}
return
0
;
}
/**
* qemudStartup:
...
...
@@ -1866,13 +1878,29 @@ static int qemudGetMaxVCPUs(virConnectPtr conn, const char *type) {
static
char
*
qemudGetCapabilities
(
virConnectPtr
conn
)
{
struct
qemud_driver
*
driver
=
conn
->
privateData
;
virCapsPtr
caps
;
char
*
xml
=
NULL
;
qemuDriverLock
(
driver
);
if
((
caps
=
qemudCapsInit
())
==
NULL
)
{
virReportOOMError
(
conn
);
goto
cleanup
;
}
if
(
qemu_driver
->
securityDriver
&&
qemudSecurityCapsInit
(
qemu_driver
->
securityDriver
,
caps
)
<
0
)
{
virCapabilitiesFree
(
caps
);
virReportOOMError
(
conn
);
goto
cleanup
;
}
virCapabilitiesFree
(
qemu_driver
->
caps
);
if
((
qemu_driver
->
caps
=
qemudCapsInit
())
==
NULL
||
(
xml
=
virCapabilitiesFormatXML
(
driver
->
caps
))
==
NULL
)
qemu_driver
->
caps
=
caps
;
if
((
xml
=
virCapabilitiesFormatXML
(
driver
->
caps
))
==
NULL
)
virReportOOMError
(
conn
);
cleanup:
qemuDriverUnlock
(
driver
);
return
xml
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录