Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
8b277ae2
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,发现更多精彩内容 >>
提交
8b277ae2
编写于
3月 08, 2017
作者:
M
Michal Privoznik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qemuBuildMemoryBackendStr: Pass virDomainMemoryDefPtr
Signed-off-by:
N
Michal Privoznik
<
mprivozn@redhat.com
>
上级
cce282fe
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
25 addition
and
35 deletion
+25
-35
src/qemu/qemu_command.c
src/qemu/qemu_command.c
+22
-27
src/qemu/qemu_command.h
src/qemu/qemu_command.h
+1
-4
src/qemu/qemu_hotplug.c
src/qemu/qemu_hotplug.c
+2
-4
未找到文件。
src/qemu/qemu_command.c
浏览文件 @
8b277ae2
...
...
@@ -3177,11 +3177,7 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
/**
* qemuBuildMemoryBackendStr:
* @size: size of the memory device in kibibytes
* @pagesize: size of the requested memory page in KiB, 0 for default
* @guestNode: NUMA node in the guest that the memory object will be attached
* to, or -1 if NUMA is not used in the guest
* @hostNodes: map of host nodes to alloc the memory in, NULL for default
* @mem: memory definition object
* @autoNodeset: fallback nodeset in case of automatic numa placement
* @def: domain definition object
* @qemuCaps: qemu capabilities object
...
...
@@ -3199,10 +3195,7 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
* -1 in case of an error.
*/
int
qemuBuildMemoryBackendStr
(
unsigned
long
long
size
,
unsigned
long
long
pagesize
,
int
guestNode
,
virBitmapPtr
userNodeset
,
qemuBuildMemoryBackendStr
(
virDomainMemoryDefPtr
mem
,
virBitmapPtr
autoNodeset
,
virDomainDefPtr
def
,
virQEMUCapsPtr
qemuCaps
,
...
...
@@ -3221,26 +3214,27 @@ qemuBuildMemoryBackendStr(unsigned long long size,
virBitmapPtr
nodemask
=
NULL
;
int
ret
=
-
1
;
virJSONValuePtr
props
=
NULL
;
bool
nodeSpecified
=
virDomainNumatuneNodeSpecified
(
def
->
numa
,
guestNode
);
bool
nodeSpecified
=
virDomainNumatuneNodeSpecified
(
def
->
numa
,
mem
->
targetNode
);
unsigned
long
long
pagesize
=
mem
->
pagesize
;
bool
needHugepage
=
!!
pagesize
;
*
backendProps
=
NULL
;
*
backendType
=
NULL
;
if
(
gues
tNode
>=
0
)
{
if
(
mem
->
targe
tNode
>=
0
)
{
/* memory devices could provide a invalid guest node */
if
(
gues
tNode
>=
virDomainNumaGetNodeCount
(
def
->
numa
))
{
if
(
mem
->
targe
tNode
>=
virDomainNumaGetNodeCount
(
def
->
numa
))
{
virReportError
(
VIR_ERR_CONFIG_UNSUPPORTED
,
_
(
"can't add memory backend for guest node '%d' as "
"the guest has only '%zu' NUMA nodes configured"
),
gues
tNode
,
virDomainNumaGetNodeCount
(
def
->
numa
));
mem
->
targe
tNode
,
virDomainNumaGetNodeCount
(
def
->
numa
));
return
-
1
;
}
memAccess
=
virDomainNumaGetNodeMemoryAccessMode
(
def
->
numa
,
gues
tNode
);
memAccess
=
virDomainNumaGetNodeMemoryAccessMode
(
def
->
numa
,
mem
->
targe
tNode
);
}
if
(
virDomainNumatuneGetMode
(
def
->
numa
,
gues
tNode
,
&
mode
)
<
0
&&
if
(
virDomainNumatuneGetMode
(
def
->
numa
,
mem
->
targe
tNode
,
&
mode
)
<
0
&&
virDomainNumatuneGetMode
(
def
->
numa
,
-
1
,
&
mode
)
<
0
)
mode
=
VIR_DOMAIN_NUMATUNE_MEM_STRICT
;
...
...
@@ -3257,10 +3251,10 @@ qemuBuildMemoryBackendStr(unsigned long long size,
}
/* just find the master hugepage in case we don't use NUMA */
if
(
gues
tNode
<
0
)
if
(
mem
->
targe
tNode
<
0
)
continue
;
if
(
virBitmapGetBit
(
hugepage
->
nodemask
,
gues
tNode
,
if
(
virBitmapGetBit
(
hugepage
->
nodemask
,
mem
->
targe
tNode
,
&
thisHugepage
)
<
0
)
{
/* Ignore this error. It's not an error after all. Well,
* the nodemask for this <page/> can contain lower NUMA
...
...
@@ -3349,14 +3343,14 @@ qemuBuildMemoryBackendStr(unsigned long long size,
*
backendType
=
"memory-backend-ram"
;
}
if
(
virJSONValueObjectAdd
(
props
,
"U:size"
,
size
*
1024
,
NULL
)
<
0
)
if
(
virJSONValueObjectAdd
(
props
,
"U:size"
,
mem
->
size
*
1024
,
NULL
)
<
0
)
goto
cleanup
;
if
(
userNodeset
)
{
nodemask
=
userNodeset
;
if
(
mem
->
sourceNodes
)
{
nodemask
=
mem
->
sourceNodes
;
}
else
{
if
(
virDomainNumatuneMaybeGetNodeset
(
def
->
numa
,
autoNodeset
,
&
nodemask
,
gues
tNode
)
<
0
)
&
nodemask
,
mem
->
targe
tNode
)
<
0
)
goto
cleanup
;
}
...
...
@@ -3371,7 +3365,7 @@ qemuBuildMemoryBackendStr(unsigned long long size,
}
/* If none of the following is requested... */
if
(
!
needHugepage
&&
!
userNodeset
&&
!
nodeSpecified
&&
if
(
!
needHugepage
&&
!
mem
->
sourceNodes
&&
!
nodeSpecified
&&
memAccess
==
VIR_DOMAIN_MEMORY_ACCESS_DEFAULT
&&
def
->
mem
.
source
!=
VIR_DOMAIN_MEMORY_SOURCE_FILE
&&
!
force
)
{
/* report back that using the new backend is not necessary
...
...
@@ -3420,17 +3414,19 @@ qemuBuildMemoryCellBackendStr(virDomainDefPtr def,
const
char
*
backendType
;
int
ret
=
-
1
;
int
rc
;
virDomainMemoryDef
mem
=
{
0
};
unsigned
long
long
memsize
=
virDomainNumaGetNodeMemorySize
(
def
->
numa
,
cell
);
*
backendStr
=
NULL
;
mem
.
size
=
memsize
;
mem
.
targetNode
=
cell
;
if
(
virAsprintf
(
&
alias
,
"ram-node%zu"
,
cell
)
<
0
)
goto
cleanup
;
if
((
rc
=
qemuBuildMemoryBackendStr
(
memsize
,
0
,
cell
,
NULL
,
auto_nodeset
,
def
,
qemuCaps
,
cfg
,
&
backendType
,
&
props
,
false
))
<
0
)
if
((
rc
=
qemuBuildMemoryBackendStr
(
&
mem
,
auto_nodeset
,
def
,
qemuCaps
,
cfg
,
&
backendType
,
&
props
,
false
))
<
0
)
goto
cleanup
;
if
(
!
(
*
backendStr
=
virQEMUBuildObjectCommandlineFromJSON
(
backendType
,
...
...
@@ -3469,8 +3465,7 @@ qemuBuildMemoryDimmBackendStr(virDomainMemoryDefPtr mem,
if
(
virAsprintf
(
&
alias
,
"mem%s"
,
mem
->
info
.
alias
)
<
0
)
goto
cleanup
;
if
(
qemuBuildMemoryBackendStr
(
mem
->
size
,
mem
->
pagesize
,
mem
->
targetNode
,
mem
->
sourceNodes
,
auto_nodeset
,
if
(
qemuBuildMemoryBackendStr
(
mem
,
auto_nodeset
,
def
,
qemuCaps
,
cfg
,
&
backendType
,
&
props
,
true
)
<
0
)
goto
cleanup
;
...
...
src/qemu/qemu_command.h
浏览文件 @
8b277ae2
...
...
@@ -124,10 +124,7 @@ char *qemuBuildControllerDevStr(const virDomainDef *domainDef,
virQEMUCapsPtr
qemuCaps
,
int
*
nusbcontroller
);
int
qemuBuildMemoryBackendStr
(
unsigned
long
long
size
,
unsigned
long
long
pagesize
,
int
guestNode
,
virBitmapPtr
userNodeset
,
int
qemuBuildMemoryBackendStr
(
virDomainMemoryDefPtr
mem
,
virBitmapPtr
autoNodeset
,
virDomainDefPtr
def
,
virQEMUCapsPtr
qemuCaps
,
...
...
src/qemu/qemu_hotplug.c
浏览文件 @
8b277ae2
...
...
@@ -2240,10 +2240,8 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver,
if
(
!
(
devstr
=
qemuBuildMemoryDeviceStr
(
mem
)))
goto
cleanup
;
if
(
qemuBuildMemoryBackendStr
(
mem
->
size
,
mem
->
pagesize
,
mem
->
targetNode
,
mem
->
sourceNodes
,
NULL
,
vm
->
def
,
priv
->
qemuCaps
,
cfg
,
&
backendType
,
&
props
,
true
)
<
0
)
if
(
qemuBuildMemoryBackendStr
(
mem
,
NULL
,
vm
->
def
,
priv
->
qemuCaps
,
cfg
,
&
backendType
,
&
props
,
true
)
<
0
)
goto
cleanup
;
if
(
virDomainMemoryInsert
(
vm
->
def
,
mem
)
<
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录