Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
0532ec3f
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看板
提交
0532ec3f
编写于
4月 07, 2015
作者:
P
Peter Krempa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
conf: Split up virDomainVcpuPinDefParseXML
Extract part that parses iothreads into virDomainIothreadPinDefParseXML
上级
06c03b48
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
66 addition
and
46 deletion
+66
-46
src/conf/domain_conf.c
src/conf/domain_conf.c
+66
-46
未找到文件。
src/conf/domain_conf.c
浏览文件 @
0532ec3f
...
...
@@ -13173,30 +13173,19 @@ virDomainIdmapDefParseXML(xmlXPathContextPtr ctxt,
return idmap;
}
/* Parse the XML definition for a vcpupin
or emulatorpin.
/* Parse the XML definition for a vcpupin
*
* vcpupin has the form of
* <vcpupin vcpu='0' cpuset='0'/>
*
* and emulatorpin has the form of
* <emulatorpin cpuset='0'/>
*
* and an iothreadspin has the form
* <iothreadpin iothread='1' cpuset='2'/>
*
* A vcpuid of -1 is valid and only valid for emulatorpin. So callers
* have to check the returned cpuid for validity.
*/
static virDomainPinDefPtr
virDomainVcpuPinDefParseXML(xmlNodePtr node,
xmlXPathContextPtr ctxt,
int maxvcpus,
bool iothreads)
int maxvcpus)
{
virDomainPinDefPtr def;
xmlNodePtr oldnode = ctxt->node;
int vcpuid = -1;
unsigned int iothreadid;
char *tmp = NULL;
int ret;
...
...
@@ -13205,28 +13194,66 @@ virDomainVcpuPinDefParseXML(xmlNodePtr node,
ctxt->node = node;
if (!iothreads) {
ret = virXPathInt("string(./@vcpu)", ctxt, &vcpuid);
if ((ret == -2) || (vcpuid < -1)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("vcpu id must be an unsigned integer or -1"));
goto error;
} else if (vcpuid == -1) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("vcpu id value -1 is not allowed for vcpupin"));
goto error;
}
ret = virXPathInt("string(./@vcpu)", ctxt, &vcpuid);
if ((ret == -2) || (vcpuid < -1)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("vcpu id must be an unsigned integer or -1"));
goto error;
} else if (vcpuid == -1) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("vcpu id value -1 is not allowed for vcpupin"));
goto error;
}
if (vcpuid >= maxvcpus) {
if (vcpuid >= maxvcpus) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("vcpu id must be less than maxvcpus"));
goto error;
}
def->id = vcpuid;
if (!(tmp = virXMLPropString(node, "cpuset"))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("vcpu id must be less than maxvcpus"));
goto error;
}
_("missing cpuset for vcpupin"));
def->id = vcpuid
;
goto error
;
}
if (iothreads && (tmp = virXPathString("string(./@iothread)", ctxt))) {
if (virBitmapParse(tmp, 0, &def->cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0)
goto error;
cleanup:
VIR_FREE(tmp);
ctxt->node = oldnode;
return def;
error:
VIR_FREE(def);
goto cleanup;
}
/* Parse the XML definition for a iothreadpin
* and an iothreadspin has the form
* <iothreadpin iothread='1' cpuset='2'/>
*/
static virDomainPinDefPtr
virDomainIOThreadPinDefParseXML(xmlNodePtr node,
xmlXPathContextPtr ctxt,
int iothreads)
{
virDomainPinDefPtr def;
xmlNodePtr oldnode = ctxt->node;
unsigned int iothreadid;
char *tmp = NULL;
if (VIR_ALLOC(def) < 0)
return NULL;
ctxt->node = node;
if ((tmp = virXPathString("string(./@iothread)", ctxt))) {
if (virStrToLong_uip(tmp, NULL, 10, &iothreadid) < 0) {
virReportError(VIR_ERR_XML_ERROR,
_("invalid setting for iothread '%s'"), tmp);
...
...
@@ -13240,11 +13267,9 @@ virDomainVcpuPinDefParseXML(xmlNodePtr node,
goto error;
}
/* NB: maxvcpus is actually def->iothreads
* IOThreads are numbered "iothread1...iothread<n>", where
* "n" is the iothreads value
*/
if (iothreadid > maxvcpus) {
/* IOThreads are numbered "iothread1...iothread<n>", where
* "n" is the iothreads value */
if (iothreadid > iothreads) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("iothread id must not exceed iothreads"));
goto error;
...
...
@@ -13254,13 +13279,8 @@ virDomainVcpuPinDefParseXML(xmlNodePtr node,
}
if (!(tmp = virXMLPropString(node, "cpuset"))) {
if (iothreads)
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("missing cpuset for iothreadpin"));
else
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("missing cpuset for vcpupin"));
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("missing cpuset for iothreadpin"));
goto error;
}
...
...
@@ -13285,6 +13305,7 @@ virDomainVcpuPinDefParseXML(xmlNodePtr node,
}
/* Parse the XML definition for emulatorpin.
* emulatorpin has the form of
* <emulatorpin cpuset='0'/>
...
...
@@ -14011,7 +14032,7 @@ virDomainDefParseXML(xmlDocPtr xml,
for (i = 0; i < n; i++) {
virDomainPinDefPtr vcpupin = NULL;
vcpupin = virDomainVcpuPinDefParseXML(nodes[i], ctxt,
def->maxvcpus
, false
);
def->maxvcpus);
if (!vcpupin)
goto error;
...
...
@@ -14098,9 +14119,8 @@ virDomainDefParseXML(xmlDocPtr xml,
for (i = 0; i < n; i++) {
virDomainPinDefPtr iothreadpin = NULL;
iothreadpin = virDomainVcpuPinDefParseXML(nodes[i], ctxt,
def->iothreads,
true);
iothreadpin = virDomainIOThreadPinDefParseXML(nodes[i], ctxt,
def->iothreads);
if (!iothreadpin)
goto error;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录