Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
fd8fd0f9
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看板
提交
fd8fd0f9
编写于
8月 21, 2012
作者:
H
Hu Tao
提交者:
Daniel Veillard
8月 22, 2012
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor virDomainVcpuPinAdd()
上级
1fea5667
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
82 addition
and
54 deletion
+82
-54
src/conf/domain_conf.c
src/conf/domain_conf.c
+32
-49
src/conf/domain_conf.h
src/conf/domain_conf.h
+2
-1
src/libxl/libxl_driver.c
src/libxl/libxl_driver.c
+12
-1
src/qemu/qemu_driver.c
src/qemu/qemu_driver.c
+24
-2
src/xen/xend_internal.c
src/xen/xend_internal.c
+12
-1
未找到文件。
src/conf/domain_conf.c
浏览文件 @
fd8fd0f9
...
...
@@ -10963,69 +10963,52 @@ cleanup:
return
bitmap
;
}
int
virDomainVcpuPinAdd
(
virDomainDefPtr
def
,
unsigned
char
*
cpumap
,
int
maplen
,
int
vcpu
)
int
virDomainVcpuPinAdd
(
virDomainVcpuPinDefPtr
*
vcpupin_list
,
int
*
nvcpupin
,
unsigned
char
*
cpumap
,
int
maplen
,
int
vcpu
)
{
virDomainVcpuPinDefPtr
*
vcpupin_list
=
NULL
;
virDomainVcpuPinDefPtr
vcpupin
=
NULL
;
char
*
cpumask
=
NULL
;
if
((
cpumask
=
bitmapFromBytemap
(
cpumap
,
maplen
))
==
NULL
)
goto
cleanup
;
/* No vcpupin exists yet. */
if
(
!
def
->
cputune
.
nvcpupin
)
{
if
(
VIR_ALLOC
(
vcpupin
)
<
0
)
{
virReportOOMError
();
goto
cleanup
;
}
if
(
!
vcpupin_list
)
return
-
1
;
if
(
VIR_ALLOC
(
vcpupin_list
)
<
0
)
{
virReportOOMError
();
VIR_FREE
(
vcpupin
);
goto
cleanup
;
}
if
((
cpumask
=
bitmapFromBytemap
(
cpumap
,
maplen
))
==
NULL
)
return
-
1
;
vcpupin
=
virDomainVcpuPinFindByVcpu
(
vcpupin_list
,
*
nvcpupin
,
vcpu
);
if
(
vcpupin
)
{
vcpupin
->
vcpuid
=
vcpu
;
vcpupin
->
cpumask
=
cpumask
;
vcpupin_list
[
def
->
cputune
.
nvcpupin
++
]
=
vcpupin
;
def
->
cputune
.
vcpupin
=
vcpupin_list
;
}
else
{
if
(
virDomainVcpuPinIsDuplicate
(
def
->
cputune
.
vcpupin
,
def
->
cputune
.
nvcpupin
,
vcpu
))
{
vcpupin
=
virDomainVcpuPinFindByVcpu
(
def
->
cputune
.
vcpupin
,
def
->
cputune
.
nvcpupin
,
vcpu
);
vcpupin
->
vcpuid
=
vcpu
;
vcpupin
->
cpumask
=
cpumask
;
}
else
{
if
(
VIR_ALLOC
(
vcpupin
)
<
0
)
{
virReportOOMError
();
goto
cleanup
;
}
return
0
;
}
/* No existing vcpupin matches vcpu, adding a new one */
if
(
VIR_ALLOC
(
vcpupin
)
<
0
)
{
virReportOOMError
();
VIR_FREE
(
cpumask
);
return
-
1
;
}
vcpupin
->
vcpuid
=
vcpu
;
vcpupin
->
cpumask
=
cpumask
;
if
(
VIR_REALLOC_N
(
def
->
cputune
.
vcpupin
,
def
->
cputune
.
nvcpupin
+
1
)
<
0
)
{
virReportOOMError
();
VIR_FREE
(
vcpupin
);
goto
cleanup
;
}
vcpupin
->
vcpuid
=
vcpu
;
vcpupin
->
cpumask
=
cpumask
;
def
->
cputune
.
vcpupin
[
def
->
cputune
.
nvcpupin
++
]
=
vcpupin
;
}
if
(
VIR_REALLOC_N
(
vcpupin_list
,
*
nvcpupin
+
1
)
<
0
)
{
virReportOOMError
();
VIR_FREE
(
cpumask
);
VIR_FREE
(
vcpupin
);
return
-
1
;
}
return
0
;
vcpupin_list
[(
*
nvcpupin
)
++
]
=
vcpupin
;
cleanup:
VIR_FREE
(
cpumask
);
return
-
1
;
return
0
;
}
int
...
...
src/conf/domain_conf.h
浏览文件 @
fd8fd0f9
...
...
@@ -1984,7 +1984,8 @@ int virDomainCpuSetParse(const char *str,
char
*
virDomainCpuSetFormat
(
char
*
cpuset
,
int
maxcpu
);
int
virDomainVcpuPinAdd
(
virDomainDefPtr
def
,
int
virDomainVcpuPinAdd
(
virDomainVcpuPinDefPtr
*
vcpupin_list
,
int
*
nvcpupin
,
unsigned
char
*
cpumap
,
int
maplen
,
int
vcpu
);
...
...
src/libxl/libxl_driver.c
浏览文件 @
fd8fd0f9
...
...
@@ -2454,7 +2454,18 @@ libxlDomainPinVcpu(virDomainPtr dom, unsigned int vcpu, unsigned char *cpumap,
goto
cleanup
;
}
if
(
virDomainVcpuPinAdd
(
vm
->
def
,
cpumap
,
maplen
,
vcpu
)
<
0
)
{
if
(
!
vm
->
def
->
cputune
.
vcpupin
)
{
if
(
VIR_ALLOC
(
vm
->
def
->
cputune
.
vcpupin
)
<
0
)
{
virReportOOMError
();
goto
cleanup
;
}
vm
->
def
->
cputune
.
nvcpupin
=
0
;
}
if
(
virDomainVcpuPinAdd
(
vm
->
def
->
cputune
.
vcpupin
,
&
vm
->
def
->
cputune
.
nvcpupin
,
cpumap
,
maplen
,
vcpu
)
<
0
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"failed to update or add vcpupin xml"
));
goto
cleanup
;
...
...
src/qemu/qemu_driver.c
浏览文件 @
fd8fd0f9
...
...
@@ -3787,7 +3787,18 @@ qemudDomainPinVcpuFlags(virDomainPtr dom,
goto
cleanup
;
}
}
else
{
if
(
virDomainVcpuPinAdd
(
vm
->
def
,
cpumap
,
maplen
,
vcpu
)
<
0
)
{
if
(
!
vm
->
def
->
cputune
.
vcpupin
)
{
if
(
VIR_ALLOC
(
vm
->
def
->
cputune
.
vcpupin
)
<
0
)
{
virReportOOMError
();
goto
cleanup
;
}
vm
->
def
->
cputune
.
nvcpupin
=
0
;
}
if
(
virDomainVcpuPinAdd
(
vm
->
def
->
cputune
.
vcpupin
,
&
vm
->
def
->
cputune
.
nvcpupin
,
cpumap
,
maplen
,
vcpu
)
<
0
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"failed to update or add vcpupin xml of "
"a running domain"
));
...
...
@@ -3809,7 +3820,18 @@ qemudDomainPinVcpuFlags(virDomainPtr dom,
goto
cleanup
;
}
}
else
{
if
(
virDomainVcpuPinAdd
(
persistentDef
,
cpumap
,
maplen
,
vcpu
)
<
0
)
{
if
(
!
persistentDef
->
cputune
.
vcpupin
)
{
if
(
VIR_ALLOC
(
persistentDef
->
cputune
.
vcpupin
)
<
0
)
{
virReportOOMError
();
goto
cleanup
;
}
persistentDef
->
cputune
.
nvcpupin
=
0
;
}
if
(
virDomainVcpuPinAdd
(
persistentDef
->
cputune
.
vcpupin
,
&
persistentDef
->
cputune
.
nvcpupin
,
cpumap
,
maplen
,
vcpu
)
<
0
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"failed to update or add vcpupin xml of "
"a persistent domain"
));
...
...
src/xen/xend_internal.c
浏览文件 @
fd8fd0f9
...
...
@@ -2296,7 +2296,18 @@ xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
goto
cleanup
;
if
(
ret
==
0
)
{
if
(
virDomainVcpuPinAdd
(
def
,
cpumap
,
maplen
,
vcpu
)
<
0
)
{
if
(
!
def
->
cputune
.
vcpupin
)
{
if
(
VIR_ALLOC
(
def
->
cputune
.
vcpupin
)
<
0
)
{
virReportOOMError
();
goto
cleanup
;
}
def
->
cputune
.
nvcpupin
=
0
;
}
if
(
virDomainVcpuPinAdd
(
def
->
cputune
.
vcpupin
,
&
def
->
cputune
.
nvcpupin
,
cpumap
,
maplen
,
vcpu
)
<
0
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"failed to add vcpupin xml entry"
));
return
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录