Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
dfc711dc
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,发现更多精彩内容 >>
提交
dfc711dc
编写于
3月 29, 2017
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qemu: Store migratable host CPU model in qemuCaps
Signed-off-by:
N
Jiri Denemark
<
jdenemar@redhat.com
>
上级
68507d77
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
71 addition
and
20 deletion
+71
-20
src/qemu/qemu_capabilities.c
src/qemu/qemu_capabilities.c
+71
-20
未找到文件。
src/qemu/qemu_capabilities.c
浏览文件 @
dfc711dc
...
...
@@ -373,6 +373,14 @@ struct virQEMUCapsMachineType {
unsigned
int
maxCpus
;
bool
hotplugCpus
;
};
typedef
struct
_virQEMUCapsCPUModel
virQEMUCapsCPUModel
;
typedef
virQEMUCapsCPUModel
*
virQEMUCapsCPUModelPtr
;
struct
_virQEMUCapsCPUModel
{
virCPUDefPtr
full
;
virCPUDefPtr
migratable
;
};
/*
* Update the XML parser/formatter when adding more
* information to this struct so that it gets cached
...
...
@@ -415,8 +423,8 @@ struct _virQEMUCaps {
* time we probe QEMU or load the results from the cache.
*/
struct
{
vir
CPUDefPtr
kvm
;
vir
CPUDefPtr
tcg
;
vir
QEMUCapsCPUModel
kvm
;
vir
QEMUCapsCPUModel
tcg
;
}
hostCPU
;
};
...
...
@@ -2101,12 +2109,20 @@ virQEMUCapsCopyHostCPUData(virQEMUCapsPtr dst,
!
(
dst
->
tcgCPUModelInfo
=
qemuMonitorCPUModelInfoCopy
(
src
->
tcgCPUModelInfo
)))
return
-
1
;
if
(
src
->
hostCPU
.
kvm
&&
!
(
dst
->
hostCPU
.
kvm
=
virCPUDefCopy
(
src
->
hostCPU
.
kvm
)))
if
(
src
->
hostCPU
.
kvm
.
full
&&
!
(
dst
->
hostCPU
.
kvm
.
full
=
virCPUDefCopy
(
src
->
hostCPU
.
kvm
.
full
)))
return
-
1
;
if
(
src
->
hostCPU
.
kvm
.
migratable
&&
!
(
dst
->
hostCPU
.
kvm
.
migratable
=
virCPUDefCopy
(
src
->
hostCPU
.
kvm
.
migratable
)))
return
-
1
;
if
(
src
->
hostCPU
.
tcg
&&
!
(
dst
->
hostCPU
.
tcg
=
virCPUDefCopy
(
src
->
hostCPU
.
tcg
)))
if
(
src
->
hostCPU
.
tcg
.
full
&&
!
(
dst
->
hostCPU
.
tcg
.
full
=
virCPUDefCopy
(
src
->
hostCPU
.
tcg
.
full
)))
return
-
1
;
if
(
src
->
hostCPU
.
tcg
.
migratable
&&
!
(
dst
->
hostCPU
.
tcg
.
migratable
=
virCPUDefCopy
(
src
->
hostCPU
.
tcg
.
migratable
)))
return
-
1
;
return
0
;
...
...
@@ -2201,8 +2217,10 @@ void virQEMUCapsDispose(void *obj)
qemuMonitorCPUModelInfoFree
(
qemuCaps
->
kvmCPUModelInfo
);
qemuMonitorCPUModelInfoFree
(
qemuCaps
->
tcgCPUModelInfo
);
virCPUDefFree
(
qemuCaps
->
hostCPU
.
kvm
);
virCPUDefFree
(
qemuCaps
->
hostCPU
.
tcg
);
virCPUDefFree
(
qemuCaps
->
hostCPU
.
kvm
.
full
);
virCPUDefFree
(
qemuCaps
->
hostCPU
.
kvm
.
migratable
);
virCPUDefFree
(
qemuCaps
->
hostCPU
.
tcg
.
full
);
virCPUDefFree
(
qemuCaps
->
hostCPU
.
tcg
.
migratable
);
}
void
...
...
@@ -2431,9 +2449,9 @@ virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps,
virDomainVirtType
type
)
{
if
(
type
==
VIR_DOMAIN_VIRT_KVM
)
return
qemuCaps
->
hostCPU
.
kvm
;
return
qemuCaps
->
hostCPU
.
kvm
.
full
;
else
return
qemuCaps
->
hostCPU
.
tcg
;
return
qemuCaps
->
hostCPU
.
tcg
.
full
;
}
...
...
@@ -3280,26 +3298,40 @@ virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps,
}
static
virCPUDefPtr
virQEMUCapsNewHostCPUModel
(
void
)
{
virCPUDefPtr
cpu
;
if
(
VIR_ALLOC
(
cpu
)
<
0
)
return
NULL
;
cpu
->
type
=
VIR_CPU_TYPE_GUEST
;
cpu
->
mode
=
VIR_CPU_MODE_CUSTOM
;
cpu
->
match
=
VIR_CPU_MATCH_EXACT
;
cpu
->
fallback
=
VIR_CPU_FALLBACK_ALLOW
;
return
cpu
;
}
void
virQEMUCapsInitHostCPUModel
(
virQEMUCapsPtr
qemuCaps
,
virCapsPtr
caps
,
virDomainVirtType
type
)
{
virCPUDefPtr
cpu
=
NULL
;
virCPUDefPtr
migCPU
=
NULL
;
virCPUDefPtr
hostCPU
=
NULL
;
virQEMUCapsCPUModelPtr
model
;
int
rc
;
if
(
!
caps
||
!
virQEMUCapsGuestIsNative
(
caps
->
host
.
arch
,
qemuCaps
->
arch
))
return
;
if
(
VIR_ALLOC
(
cpu
)
<
0
)
if
(
!
(
cpu
=
virQEMUCapsNewHostCPUModel
())
)
goto
error
;
cpu
->
type
=
VIR_CPU_TYPE_GUEST
;
cpu
->
mode
=
VIR_CPU_MODE_CUSTOM
;
cpu
->
match
=
VIR_CPU_MATCH_EXACT
;
cpu
->
fallback
=
VIR_CPU_FALLBACK_ALLOW
;
if
((
rc
=
virQEMUCapsInitCPUModel
(
qemuCaps
,
type
,
cpu
,
false
))
<
0
)
{
goto
error
;
}
else
if
(
rc
==
1
)
{
...
...
@@ -3313,10 +3345,26 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
goto
error
;
}
if
(
!
(
migCPU
=
virQEMUCapsNewHostCPUModel
()))
goto
error
;
if
((
rc
=
virQEMUCapsInitCPUModel
(
qemuCaps
,
type
,
migCPU
,
true
))
<
0
)
{
goto
error
;
}
else
if
(
rc
==
1
)
{
VIR_DEBUG
(
"CPU migratibility not provided by QEMU"
);
virCPUDefFree
(
migCPU
);
if
(
!
(
migCPU
=
virCPUCopyMigratable
(
qemuCaps
->
arch
,
cpu
)))
goto
error
;
}
if
(
type
==
VIR_DOMAIN_VIRT_KVM
)
qemuCaps
->
hostCPU
.
kvm
=
cpu
;
model
=
&
qemuCaps
->
hostCPU
.
kvm
;
else
qemuCaps
->
hostCPU
.
tcg
=
cpu
;
model
=
&
qemuCaps
->
hostCPU
.
tcg
;
model
->
full
=
cpu
;
model
->
migratable
=
migCPU
;
cleanup:
virCPUDefFree
(
hostCPU
);
...
...
@@ -3324,6 +3372,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
error:
virCPUDefFree
(
cpu
);
virCPUDefFree
(
migCPU
);
virResetLastError
();
goto
cleanup
;
}
...
...
@@ -4071,8 +4120,10 @@ virQEMUCapsReset(virQEMUCapsPtr qemuCaps)
qemuCaps
->
kvmCPUModelInfo
=
NULL
;
qemuCaps
->
tcgCPUModelInfo
=
NULL
;
virCPUDefFree
(
qemuCaps
->
hostCPU
.
kvm
);
virCPUDefFree
(
qemuCaps
->
hostCPU
.
tcg
);
virCPUDefFree
(
qemuCaps
->
hostCPU
.
kvm
.
full
);
virCPUDefFree
(
qemuCaps
->
hostCPU
.
kvm
.
migratable
);
virCPUDefFree
(
qemuCaps
->
hostCPU
.
tcg
.
full
);
virCPUDefFree
(
qemuCaps
->
hostCPU
.
tcg
.
migratable
);
memset
(
&
qemuCaps
->
hostCPU
,
0
,
sizeof
(
qemuCaps
->
hostCPU
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录