Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
81800ff6
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,发现更多精彩内容 >>
提交
81800ff6
编写于
4月 03, 2011
作者:
M
Matthias Bolte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vmx: Support persistent CPU shares
上级
fb92307f
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
72 addition
and
2 deletion
+72
-2
src/vmx/vmx.c
src/vmx/vmx.c
+43
-0
tests/vmx2xmldata/vmx2xml-case-insensitive-1.vmx
tests/vmx2xmldata/vmx2xml-case-insensitive-1.vmx
+1
-1
tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml
tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml
+3
-0
tests/vmx2xmldata/vmx2xml-case-insensitive-2.xml
tests/vmx2xmldata/vmx2xml-case-insensitive-2.xml
+3
-0
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-1.vmx
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-1.vmx
+1
-1
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-1.xml
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-1.xml
+3
-0
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-4.xml
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-4.xml
+3
-0
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml
+3
-0
tests/xml2vmxdata/xml2vmx-esx-in-the-wild-1.vmx
tests/xml2vmxdata/xml2vmx-esx-in-the-wild-1.vmx
+1
-0
tests/xml2vmxdata/xml2vmx-esx-in-the-wild-1.xml
tests/xml2vmxdata/xml2vmx-esx-in-the-wild-1.xml
+3
-0
tests/xml2vmxdata/xml2vmx-esx-in-the-wild-4.vmx
tests/xml2vmxdata/xml2vmx-esx-in-the-wild-4.vmx
+1
-0
tests/xml2vmxdata/xml2vmx-esx-in-the-wild-4.xml
tests/xml2vmxdata/xml2vmx-esx-in-the-wild-4.xml
+3
-0
tests/xml2vmxdata/xml2vmx-esx-in-the-wild-5.vmx
tests/xml2vmxdata/xml2vmx-esx-in-the-wild-5.vmx
+1
-0
tests/xml2vmxdata/xml2vmx-esx-in-the-wild-5.xml
tests/xml2vmxdata/xml2vmx-esx-in-the-wild-5.xml
+3
-0
未找到文件。
src/vmx/vmx.c
浏览文件 @
81800ff6
...
...
@@ -55,6 +55,8 @@ def->mem.cur_balloon = <value kilobyte> <=> sched.mem.max = "<value megabyt
def->mem.min_guarantee = <value kilobyte> <=> sched.mem.minsize = "<value megabyte>" # defaults to 0
def->maxvcpus = <value> <=> numvcpus = "<value>" # must be 1 or a multiple of 2, defaults to 1
def->cpumask = <uint list> <=> sched.cpu.affinity = "<uint list>"
def->cputune.shares = <value> <=> sched.cpu.shares = "<value>" # with handling for special values
# "high", "normal", "low"
...
...
@@ -1200,6 +1202,7 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx)
long
long
sched_mem_minsize
=
0
;
long
long
numvcpus
=
0
;
char
*
sched_cpu_affinity
=
NULL
;
char
*
sched_cpu_shares
=
NULL
;
char
*
guestOS
=
NULL
;
bool
smbios_reflecthost
=
false
;
int
controller
;
...
...
@@ -1449,6 +1452,30 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx)
}
}
/* vmx:sched.cpu.shares -> def:cputune.shares */
if
(
virVMXGetConfigString
(
conf
,
"sched.cpu.shares"
,
&
sched_cpu_shares
,
true
)
<
0
)
{
goto
cleanup
;
}
if
(
sched_cpu_shares
!=
NULL
)
{
/* See http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.SharesInfo.Level.html */
if
(
STRCASEEQ
(
sched_cpu_shares
,
"low"
))
{
def
->
cputune
.
shares
=
def
->
vcpus
*
500
;
}
else
if
(
STRCASEEQ
(
sched_cpu_shares
,
"normal"
))
{
def
->
cputune
.
shares
=
def
->
vcpus
*
1000
;
}
else
if
(
STRCASEEQ
(
sched_cpu_shares
,
"high"
))
{
def
->
cputune
.
shares
=
def
->
vcpus
*
2000
;
}
else
if
(
virStrToLong_ul
(
sched_cpu_shares
,
NULL
,
10
,
&
def
->
cputune
.
shares
)
<
0
)
{
VMX_ERROR
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Expecting VMX entry 'sched.cpu.shares' to be an "
"unsigned integer or 'low', 'normal' or 'high' but "
"found '%s'"
),
sched_cpu_shares
);
goto
cleanup
;
}
}
/* def:lifecycle */
def
->
onReboot
=
VIR_DOMAIN_LIFECYCLE_RESTART
;
def
->
onPoweroff
=
VIR_DOMAIN_LIFECYCLE_DESTROY
;
...
...
@@ -1715,6 +1742,7 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx)
virConfFree
(
conf
);
VIR_FREE
(
encoding
);
VIR_FREE
(
sched_cpu_affinity
);
VIR_FREE
(
sched_cpu_shares
);
VIR_FREE
(
guestOS
);
return
def
;
...
...
@@ -2998,6 +3026,21 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def,
virBufferAddLit
(
&
buffer
,
"
\"\n
"
);
}
/* def:cputune.shares -> vmx:sched.cpu.shares */
if
(
def
->
cputune
.
shares
>
0
)
{
/* See http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.SharesInfo.Level.html */
if
(
def
->
cputune
.
shares
==
def
->
vcpus
*
500
)
{
virBufferAddLit
(
&
buffer
,
"sched.cpu.shares =
\"
low
\"\n
"
);
}
else
if
(
def
->
cputune
.
shares
==
def
->
vcpus
*
1000
)
{
virBufferAddLit
(
&
buffer
,
"sched.cpu.shares =
\"
normal
\"\n
"
);
}
else
if
(
def
->
cputune
.
shares
==
def
->
vcpus
*
2000
)
{
virBufferAddLit
(
&
buffer
,
"sched.cpu.shares =
\"
high
\"\n
"
);
}
else
{
virBufferVSprintf
(
&
buffer
,
"sched.cpu.shares =
\"
%lu
\"\n
"
,
def
->
cputune
.
shares
);
}
}
/* def:graphics */
for
(
i
=
0
;
i
<
def
->
ngraphics
;
++
i
)
{
switch
(
def
->
graphics
[
i
]
->
type
)
{
...
...
tests/vmx2xmldata/vmx2xml-case-insensitive-1.vmx
浏览文件 @
81800ff6
...
...
@@ -35,7 +35,7 @@ UUID.BIOS = "50 11 5E 16 9B DC 49 D7-F1 71 53 C4 D7 F9 17 10"
SNAPSHOT.ACTION = "KEEP"
SCHED.CPU.MIN = "0"
SCHED.CPU.UNITS = "MHZ"
SCHED.CPU.SHARES = "
NORMAL
"
SCHED.CPU.SHARES = "
4223
"
SCHED.MEM.MINSIZE = "0"
SCHED.MEM.SHARES = "NORMAL"
TOOLSCRIPTS.AFTERPOWERON = "TRUE"
...
...
tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml
浏览文件 @
81800ff6
...
...
@@ -4,6 +4,9 @@
<memory>
1048576
</memory>
<currentMemory>
1048576
</currentMemory>
<vcpu>
1
</vcpu>
<cputune>
<shares>
4223
</shares>
</cputune>
<os>
<type
arch=
'i686'
>
hvm
</type>
</os>
...
...
tests/vmx2xmldata/vmx2xml-case-insensitive-2.xml
浏览文件 @
81800ff6
...
...
@@ -4,6 +4,9 @@
<memory>
1048576
</memory>
<currentMemory>
1048576
</currentMemory>
<vcpu>
1
</vcpu>
<cputune>
<shares>
1000
</shares>
</cputune>
<os>
<type
arch=
'i686'
>
hvm
</type>
</os>
...
...
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-1.vmx
浏览文件 @
81800ff6
...
...
@@ -36,7 +36,7 @@ uuid.bios = "50 11 5e 16 9b dc 49 d7-f1 71 53 c4 d7 f9 17 10"
snapshot.action = "keep"
sched.cpu.min = "0"
sched.cpu.units = "mhz"
sched.cpu.shares = "
normal
"
sched.cpu.shares = "
low
"
sched.mem.minsize = "0"
sched.mem.shares = "normal"
toolScripts.afterPowerOn = "true"
...
...
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-1.xml
浏览文件 @
81800ff6
...
...
@@ -4,6 +4,9 @@
<memory>
1048576
</memory>
<currentMemory>
1048576
</currentMemory>
<vcpu>
1
</vcpu>
<cputune>
<shares>
500
</shares>
</cputune>
<os>
<type
arch=
'i686'
>
hvm
</type>
</os>
...
...
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-4.xml
浏览文件 @
81800ff6
...
...
@@ -4,6 +4,9 @@
<memory>
524288
</memory>
<currentMemory>
524288
</currentMemory>
<vcpu>
1
</vcpu>
<cputune>
<shares>
1000
</shares>
</cputune>
<os>
<type
arch=
'i686'
>
hvm
</type>
</os>
...
...
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml
浏览文件 @
81800ff6
...
...
@@ -8,6 +8,9 @@
<min_guarantee>
262144
</min_guarantee>
</memtune>
<vcpu>
2
</vcpu>
<cputune>
<shares>
2000
</shares>
</cputune>
<os>
<type
arch=
'x86_64'
>
hvm
</type>
</os>
...
...
tests/xml2vmxdata/xml2vmx-esx-in-the-wild-1.vmx
浏览文件 @
81800ff6
...
...
@@ -6,6 +6,7 @@ uuid.bios = "50 11 5e 16 9b dc 49 d7-f1 71 53 c4 d7 f9 17 10"
displayName = "Fedora11"
memsize = "1024"
numvcpus = "1"
sched.cpu.shares = "low"
scsi0.present = "true"
scsi0.virtualDev = "lsilogic"
scsi0:0.present = "true"
...
...
tests/xml2vmxdata/xml2vmx-esx-in-the-wild-1.xml
浏览文件 @
81800ff6
...
...
@@ -4,6 +4,9 @@
<memory>
1048576
</memory>
<currentMemory>
1048576
</currentMemory>
<vcpu>
1
</vcpu>
<cputune>
<shares>
500
</shares>
</cputune>
<os>
<type>
hvm
</type>
</os>
...
...
tests/xml2vmxdata/xml2vmx-esx-in-the-wild-4.vmx
浏览文件 @
81800ff6
...
...
@@ -6,6 +6,7 @@ uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
displayName = "virtMonServ1"
memsize = "512"
numvcpus = "1"
sched.cpu.shares = "normal"
scsi0.present = "true"
scsi0.virtualDev = "lsilogic"
scsi0:0.present = "true"
...
...
tests/xml2vmxdata/xml2vmx-esx-in-the-wild-4.xml
浏览文件 @
81800ff6
...
...
@@ -4,6 +4,9 @@
<memory>
524288
</memory>
<currentMemory>
524288
</currentMemory>
<vcpu>
1
</vcpu>
<cputune>
<shares>
1000
</shares>
</cputune>
<os>
<type>
hvm
</type>
</os>
...
...
tests/xml2vmxdata/xml2vmx-esx-in-the-wild-5.vmx
浏览文件 @
81800ff6
...
...
@@ -8,6 +8,7 @@ annotation = "Centos 5.5 64bit Server"
memsize = "2048"
sched.mem.minsize = "256"
numvcpus = "2"
sched.cpu.shares = "normal"
scsi0.present = "true"
scsi0.virtualDev = "lsilogic"
scsi0:0.present = "true"
...
...
tests/xml2vmxdata/xml2vmx-esx-in-the-wild-5.xml
浏览文件 @
81800ff6
...
...
@@ -8,6 +8,9 @@
<min_guarantee>
262144
</min_guarantee>
</memtune>
<vcpu>
2
</vcpu>
<cputune>
<shares>
2000
</shares>
</cputune>
<os>
<type
arch=
'x86_64'
>
hvm
</type>
</os>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录