Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
50234e4e
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,发现更多精彩内容 >>
提交
50234e4e
编写于
9月 13, 2017
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cpu: Use virCPUDefListParse in cpuBaselineXML
Signed-off-by:
N
Jiri Denemark
<
jdenemar@redhat.com
>
上级
57f3999d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
6 addition
and
46 deletion
+6
-46
src/cpu/cpu.c
src/cpu/cpu.c
+6
-46
未找到文件。
src/cpu/cpu.c
浏览文件 @
50234e4e
...
...
@@ -523,11 +523,9 @@ cpuBaselineXML(const char **xmlCPUs,
unsigned
int
nmodels
,
unsigned
int
flags
)
{
xmlDocPtr
doc
=
NULL
;
xmlXPathContextPtr
ctxt
=
NULL
;
virCPUDefPtr
*
cpus
=
NULL
;
virCPUDefPtr
cpu
=
NULL
;
char
*
cpustr
;
char
*
cpustr
=
NULL
;
size_t
i
;
VIR_DEBUG
(
"ncpus=%u, nmodels=%u"
,
ncpus
,
nmodels
);
...
...
@@ -535,67 +533,29 @@ cpuBaselineXML(const char **xmlCPUs,
virCheckFlags
(
VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES
|
VIR_CONNECT_BASELINE_CPU_MIGRATABLE
,
NULL
);
if
(
xmlCPUs
)
{
for
(
i
=
0
;
i
<
ncpus
;
i
++
)
VIR_DEBUG
(
"xmlCPUs[%zu]=%s"
,
i
,
NULLSTR
(
xmlCPUs
[
i
]));
}
if
(
models
)
{
for
(
i
=
0
;
i
<
nmodels
;
i
++
)
VIR_DEBUG
(
"models[%zu]=%s"
,
i
,
NULLSTR
(
models
[
i
]));
}
if
(
xmlCPUs
==
NULL
&&
ncpus
!=
0
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"nonzero ncpus doesn't match with NULL xmlCPUs"
));
return
NULL
;
}
if
(
ncpus
<
1
)
{
virReportError
(
VIR_ERR_INVALID_ARG
,
"%s"
,
_
(
"No CPUs given"
));
return
NULL
;
}
if
(
VIR_ALLOC_N
(
cpus
,
ncpus
))
goto
error
;
for
(
i
=
0
;
i
<
ncpus
;
i
++
)
{
if
(
!
(
doc
=
virXMLParseStringCtxt
(
xmlCPUs
[
i
],
_
(
"(CPU_definition)"
),
&
ctxt
)))
goto
error
;
if
(
virCPUDefParseXML
(
ctxt
,
NULL
,
VIR_CPU_TYPE_HOST
,
&
cpus
[
i
])
<
0
)
goto
error
;
xmlXPathFreeContext
(
ctxt
);
xmlFreeDoc
(
doc
);
ctxt
=
NULL
;
doc
=
NULL
;
}
if
(
!
(
cpus
=
virCPUDefListParse
(
xmlCPUs
,
ncpus
,
VIR_CPU_TYPE_HOST
)))
goto
cleanup
;
if
(
!
(
cpu
=
cpuBaseline
(
cpus
,
ncpus
,
models
,
nmodels
,
!!
(
flags
&
VIR_CONNECT_BASELINE_CPU_MIGRATABLE
))))
goto
error
;
goto
cleanup
;
if
((
flags
&
VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES
)
&&
virCPUExpandFeatures
(
cpus
[
0
]
->
arch
,
cpu
)
<
0
)
goto
error
;
goto
cleanup
;
cpustr
=
virCPUDefFormat
(
cpu
,
NULL
,
false
);
cleanup:
if
(
cpus
)
{
for
(
i
=
0
;
i
<
ncpus
;
i
++
)
virCPUDefFree
(
cpus
[
i
]);
VIR_FREE
(
cpus
);
}
virCPUDefListFree
(
cpus
);
virCPUDefFree
(
cpu
);
xmlXPathFreeContext
(
ctxt
);
xmlFreeDoc
(
doc
);
return
cpustr
;
error:
cpustr
=
NULL
;
goto
cleanup
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录