Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
71c89ac9
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看板
提交
71c89ac9
编写于
10月 22, 2015
作者:
P
Peter Krempa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
conf: Replace read accesses to def->vcpus with accessor
上级
80a8ac3c
变更
25
隐藏空白更改
内联
并排
Showing
25 changed file
with
83 addition
and
69 deletion
+83
-69
src/bhyve/bhyve_command.c
src/bhyve/bhyve_command.c
+1
-1
src/bhyve/bhyve_driver.c
src/bhyve/bhyve_driver.c
+1
-1
src/conf/domain_audit.c
src/conf/domain_audit.c
+1
-1
src/conf/domain_conf.c
src/conf/domain_conf.c
+13
-6
src/conf/domain_conf.h
src/conf/domain_conf.h
+1
-0
src/libvirt_private.syms
src/libvirt_private.syms
+1
-0
src/libxl/libxl_conf.c
src/libxl/libxl_conf.c
+1
-1
src/libxl/libxl_driver.c
src/libxl/libxl_driver.c
+4
-4
src/lxc/lxc_controller.c
src/lxc/lxc_controller.c
+1
-1
src/lxc/lxc_driver.c
src/lxc/lxc_driver.c
+1
-1
src/openvz/openvz_driver.c
src/openvz/openvz_driver.c
+1
-1
src/phyp/phyp_driver.c
src/phyp/phyp_driver.c
+3
-2
src/qemu/qemu_command.c
src/qemu/qemu_command.c
+1
-1
src/qemu/qemu_driver.c
src/qemu/qemu_driver.c
+18
-18
src/qemu/qemu_process.c
src/qemu/qemu_process.c
+5
-5
src/test/test_driver.c
src/test/test_driver.c
+7
-7
src/uml/uml_driver.c
src/uml/uml_driver.c
+1
-1
src/vmware/vmware_driver.c
src/vmware/vmware_driver.c
+1
-1
src/vmx/vmx.c
src/vmx/vmx.c
+8
-6
src/vz/vz_driver.c
src/vz/vz_driver.c
+3
-3
src/vz/vz_sdk.c
src/vz/vz_sdk.c
+2
-2
src/xen/xm_internal.c
src/xen/xm_internal.c
+2
-2
src/xenapi/xenapi_utils.c
src/xenapi/xenapi_utils.c
+1
-1
src/xenconfig/xen_common.c
src/xenconfig/xen_common.c
+2
-1
src/xenconfig/xen_sxpr.c
src/xenconfig/xen_sxpr.c
+3
-2
未找到文件。
src/bhyve/bhyve_command.c
浏览文件 @
71c89ac9
...
@@ -232,7 +232,7 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn,
...
@@ -232,7 +232,7 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn,
/* CPUs */
/* CPUs */
virCommandAddArg
(
cmd
,
"-c"
);
virCommandAddArg
(
cmd
,
"-c"
);
virCommandAddArgFormat
(
cmd
,
"%d"
,
def
->
vcpus
);
virCommandAddArgFormat
(
cmd
,
"%d"
,
virDomainDefGetVcpus
(
def
)
);
/* Memory */
/* Memory */
virCommandAddArg
(
cmd
,
"-m"
);
virCommandAddArg
(
cmd
,
"-m"
);
...
...
src/bhyve/bhyve_driver.c
浏览文件 @
71c89ac9
...
@@ -304,7 +304,7 @@ bhyveDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
...
@@ -304,7 +304,7 @@ bhyveDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
info
->
state
=
virDomainObjGetState
(
vm
,
NULL
);
info
->
state
=
virDomainObjGetState
(
vm
,
NULL
);
info
->
maxMem
=
virDomainDefGetMemoryActual
(
vm
->
def
);
info
->
maxMem
=
virDomainDefGetMemoryActual
(
vm
->
def
);
info
->
nrVirtCpu
=
v
m
->
def
->
vcpus
;
info
->
nrVirtCpu
=
v
irDomainDefGetVcpus
(
vm
->
def
)
;
ret
=
0
;
ret
=
0
;
cleanup:
cleanup:
...
...
src/conf/domain_audit.c
浏览文件 @
71c89ac9
...
@@ -885,7 +885,7 @@ virDomainAuditStart(virDomainObjPtr vm, const char *reason, bool success)
...
@@ -885,7 +885,7 @@ virDomainAuditStart(virDomainObjPtr vm, const char *reason, bool success)
virDomainAuditMemory
(
vm
,
0
,
virDomainDefGetMemoryActual
(
vm
->
def
),
virDomainAuditMemory
(
vm
,
0
,
virDomainDefGetMemoryActual
(
vm
->
def
),
"start"
,
true
);
"start"
,
true
);
virDomainAuditVcpu
(
vm
,
0
,
v
m
->
def
->
vcpus
,
"start"
,
true
);
virDomainAuditVcpu
(
vm
,
0
,
v
irDomainDefGetVcpus
(
vm
->
def
)
,
"start"
,
true
);
if
(
vm
->
def
->
niothreadids
)
if
(
vm
->
def
->
niothreadids
)
virDomainAuditIOThread
(
vm
,
0
,
vm
->
def
->
niothreadids
,
"start"
,
true
);
virDomainAuditIOThread
(
vm
,
0
,
vm
->
def
->
niothreadids
,
"start"
,
true
);
...
...
src/conf/domain_conf.c
浏览文件 @
71c89ac9
...
@@ -1328,6 +1328,13 @@ virDomainDefSetVcpus(virDomainDefPtr def,
...
@@ -1328,6 +1328,13 @@ virDomainDefSetVcpus(virDomainDefPtr def,
}
}
unsigned int
virDomainDefGetVcpus(const virDomainDef *def)
{
return def->vcpus;
}
virDomainDiskDefPtr
virDomainDiskDefPtr
virDomainDiskDefNew(virDomainXMLOptionPtr xmlopt)
virDomainDiskDefNew(virDomainXMLOptionPtr xmlopt)
{
{
...
@@ -14918,7 +14925,7 @@ virDomainDefParseXML(xmlDocPtr xml,
...
@@ -14918,7 +14925,7 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error;
goto error;
}
}
if (vcpupin->id >=
def->vcpus
) {
if (vcpupin->id >=
virDomainDefGetVcpus(def)
) {
/* To avoid the regression when daemon loading
/* To avoid the regression when daemon loading
* domain confs, we can't simply error out if
* domain confs, we can't simply error out if
* <vcpupin> nodes greater than current vcpus,
* <vcpupin> nodes greater than current vcpus,
...
@@ -14936,10 +14943,10 @@ virDomainDefParseXML(xmlDocPtr xml,
...
@@ -14936,10 +14943,10 @@ virDomainDefParseXML(xmlDocPtr xml,
* the policy specified explicitly as def->cpuset.
* the policy specified explicitly as def->cpuset.
*/
*/
if (def->cpumask) {
if (def->cpumask) {
if (VIR_REALLOC_N(def->cputune.vcpupin,
def->vcpus
) < 0)
if (VIR_REALLOC_N(def->cputune.vcpupin,
virDomainDefGetVcpus(def)
) < 0)
goto error;
goto error;
for (i = 0; i <
def->vcpus
; i++) {
for (i = 0; i <
virDomainDefGetVcpus(def)
; i++) {
if (virDomainPinIsDuplicate(def->cputune.vcpupin,
if (virDomainPinIsDuplicate(def->cputune.vcpupin,
def->cputune.nvcpupin,
def->cputune.nvcpupin,
i))
i))
...
@@ -17572,10 +17579,10 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
...
@@ -17572,10 +17579,10 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
goto error;
goto error;
}
}
if (
src->vcpus != dst->vcpus
) {
if (
virDomainDefGetVcpus(src) != virDomainDefGetVcpus(dst)
) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Target domain vCPU count %d does not match source %d"),
_("Target domain vCPU count %d does not match source %d"),
dst->vcpus, src->vcpus
);
virDomainDefGetVcpus(dst), virDomainDefGetVcpus(src)
);
goto error;
goto error;
}
}
if (virDomainDefGetVcpusMax(src) != virDomainDefGetVcpusMax(dst)) {
if (virDomainDefGetVcpusMax(src) != virDomainDefGetVcpusMax(dst)) {
...
@@ -21551,7 +21558,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
...
@@ -21551,7 +21558,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
VIR_FREE(cpumask);
VIR_FREE(cpumask);
}
}
if (virDomainDefHasVcpusOffline(def))
if (virDomainDefHasVcpusOffline(def))
virBufferAsprintf(buf, " current='%u'",
def->vcpus
);
virBufferAsprintf(buf, " current='%u'",
virDomainDefGetVcpus(def)
);
virBufferAsprintf(buf, ">%u</vcpu>\n", virDomainDefGetVcpusMax(def));
virBufferAsprintf(buf, ">%u</vcpu>\n", virDomainDefGetVcpusMax(def));
if (def->niothreadids > 0) {
if (def->niothreadids > 0) {
...
...
src/conf/domain_conf.h
浏览文件 @
71c89ac9
...
@@ -2347,6 +2347,7 @@ int virDomainDefSetVcpusMax(virDomainDefPtr def, unsigned int vcpus);
...
@@ -2347,6 +2347,7 @@ int virDomainDefSetVcpusMax(virDomainDefPtr def, unsigned int vcpus);
bool
virDomainDefHasVcpusOffline
(
const
virDomainDef
*
def
);
bool
virDomainDefHasVcpusOffline
(
const
virDomainDef
*
def
);
unsigned
int
virDomainDefGetVcpusMax
(
const
virDomainDef
*
def
);
unsigned
int
virDomainDefGetVcpusMax
(
const
virDomainDef
*
def
);
int
virDomainDefSetVcpus
(
virDomainDefPtr
def
,
unsigned
int
vcpus
);
int
virDomainDefSetVcpus
(
virDomainDefPtr
def
,
unsigned
int
vcpus
);
unsigned
int
virDomainDefGetVcpus
(
const
virDomainDef
*
def
);
unsigned
long
long
virDomainDefGetMemoryInitial
(
const
virDomainDef
*
def
);
unsigned
long
long
virDomainDefGetMemoryInitial
(
const
virDomainDef
*
def
);
void
virDomainDefSetMemoryTotal
(
virDomainDefPtr
def
,
unsigned
long
long
size
);
void
virDomainDefSetMemoryTotal
(
virDomainDefPtr
def
,
unsigned
long
long
size
);
...
...
src/libvirt_private.syms
浏览文件 @
71c89ac9
...
@@ -217,6 +217,7 @@ virDomainDefGetDefaultEmulator;
...
@@ -217,6 +217,7 @@ virDomainDefGetDefaultEmulator;
virDomainDefGetMemoryActual;
virDomainDefGetMemoryActual;
virDomainDefGetMemoryInitial;
virDomainDefGetMemoryInitial;
virDomainDefGetSecurityLabelDef;
virDomainDefGetSecurityLabelDef;
virDomainDefGetVcpus;
virDomainDefGetVcpusMax;
virDomainDefGetVcpusMax;
virDomainDefHasDeviceAddress;
virDomainDefHasDeviceAddress;
virDomainDefHasMemoryHotplug;
virDomainDefHasMemoryHotplug;
...
...
src/libxl/libxl_conf.c
浏览文件 @
71c89ac9
...
@@ -647,7 +647,7 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
...
@@ -647,7 +647,7 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
if
(
libxl_cpu_bitmap_alloc
(
ctx
,
&
b_info
->
avail_vcpus
,
b_info
->
max_vcpus
))
if
(
libxl_cpu_bitmap_alloc
(
ctx
,
&
b_info
->
avail_vcpus
,
b_info
->
max_vcpus
))
return
-
1
;
return
-
1
;
libxl_bitmap_set_none
(
&
b_info
->
avail_vcpus
);
libxl_bitmap_set_none
(
&
b_info
->
avail_vcpus
);
for
(
i
=
0
;
i
<
def
->
vcpus
;
i
++
)
for
(
i
=
0
;
i
<
virDomainDefGetVcpus
(
def
)
;
i
++
)
libxl_bitmap_set
((
&
b_info
->
avail_vcpus
),
i
);
libxl_bitmap_set
((
&
b_info
->
avail_vcpus
),
i
);
if
(
def
->
clock
.
ntimers
>
0
&&
if
(
def
->
clock
.
ntimers
>
0
&&
...
...
src/libxl/libxl_driver.c
浏览文件 @
71c89ac9
...
@@ -1601,7 +1601,7 @@ libxlDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
...
@@ -1601,7 +1601,7 @@ libxlDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
}
}
info
->
state
=
virDomainObjGetState
(
vm
,
NULL
);
info
->
state
=
virDomainObjGetState
(
vm
,
NULL
);
info
->
nrVirtCpu
=
v
m
->
def
->
vcpus
;
info
->
nrVirtCpu
=
v
irDomainDefGetVcpus
(
vm
->
def
)
;
ret
=
0
;
ret
=
0
;
cleanup:
cleanup:
...
@@ -2304,7 +2304,7 @@ libxlDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
...
@@ -2304,7 +2304,7 @@ libxlDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
if
(
flags
&
VIR_DOMAIN_VCPU_MAXIMUM
)
if
(
flags
&
VIR_DOMAIN_VCPU_MAXIMUM
)
ret
=
virDomainDefGetVcpusMax
(
def
);
ret
=
virDomainDefGetVcpusMax
(
def
);
else
else
ret
=
def
->
vcpus
;
ret
=
virDomainDefGetVcpus
(
def
)
;
cleanup:
cleanup:
if
(
vm
)
if
(
vm
)
...
@@ -2441,8 +2441,8 @@ libxlDomainGetVcpuPinInfo(virDomainPtr dom, int ncpumaps,
...
@@ -2441,8 +2441,8 @@ libxlDomainGetVcpuPinInfo(virDomainPtr dom, int ncpumaps,
sa_assert
(
targetDef
);
sa_assert
(
targetDef
);
/* Clamp to actual number of vcpus */
/* Clamp to actual number of vcpus */
if
(
ncpumaps
>
targetDef
->
vcpus
)
if
(
ncpumaps
>
virDomainDefGetVcpus
(
targetDef
)
)
ncpumaps
=
targetDef
->
vcpus
;
ncpumaps
=
virDomainDefGetVcpus
(
targetDef
)
;
if
((
hostcpus
=
libxl_get_max_cpus
(
cfg
->
ctx
))
<
0
)
if
((
hostcpus
=
libxl_get_max_cpus
(
cfg
->
ctx
))
<
0
)
goto
cleanup
;
goto
cleanup
;
...
...
src/lxc/lxc_controller.c
浏览文件 @
71c89ac9
...
@@ -771,7 +771,7 @@ static int virLXCControllerGetNumadAdvice(virLXCControllerPtr ctrl,
...
@@ -771,7 +771,7 @@ static int virLXCControllerGetNumadAdvice(virLXCControllerPtr ctrl,
* either <vcpu> or <numatune> is 'auto'.
* either <vcpu> or <numatune> is 'auto'.
*/
*/
if
(
virDomainDefNeedsPlacementAdvice
(
ctrl
->
def
))
{
if
(
virDomainDefNeedsPlacementAdvice
(
ctrl
->
def
))
{
nodeset
=
virNumaGetAutoPlacementAdvice
(
ctrl
->
def
->
vcpus
,
nodeset
=
virNumaGetAutoPlacementAdvice
(
virDomainDefGetVcpus
(
ctrl
->
def
)
,
ctrl
->
def
->
mem
.
cur_balloon
);
ctrl
->
def
->
mem
.
cur_balloon
);
if
(
!
nodeset
)
if
(
!
nodeset
)
goto
cleanup
;
goto
cleanup
;
...
...
src/lxc/lxc_driver.c
浏览文件 @
71c89ac9
...
@@ -617,7 +617,7 @@ static int lxcDomainGetInfo(virDomainPtr dom,
...
@@ -617,7 +617,7 @@ static int lxcDomainGetInfo(virDomainPtr dom,
}
}
info
->
maxMem
=
virDomainDefGetMemoryActual
(
vm
->
def
);
info
->
maxMem
=
virDomainDefGetMemoryActual
(
vm
->
def
);
info
->
nrVirtCpu
=
v
m
->
def
->
vcpus
;
info
->
nrVirtCpu
=
v
irDomainDefGetVcpus
(
vm
->
def
)
;
ret
=
0
;
ret
=
0
;
cleanup:
cleanup:
...
...
src/openvz/openvz_driver.c
浏览文件 @
71c89ac9
...
@@ -465,7 +465,7 @@ static int openvzDomainGetInfo(virDomainPtr dom,
...
@@ -465,7 +465,7 @@ static int openvzDomainGetInfo(virDomainPtr dom,
info
->
maxMem
=
virDomainDefGetMemoryActual
(
vm
->
def
);
info
->
maxMem
=
virDomainDefGetMemoryActual
(
vm
->
def
);
info
->
memory
=
vm
->
def
->
mem
.
cur_balloon
;
info
->
memory
=
vm
->
def
->
mem
.
cur_balloon
;
info
->
nrVirtCpu
=
v
m
->
def
->
vcpus
;
info
->
nrVirtCpu
=
v
irDomainDefGetVcpus
(
vm
->
def
)
;
ret
=
0
;
ret
=
0
;
cleanup:
cleanup:
...
...
src/phyp/phyp_driver.c
浏览文件 @
71c89ac9
...
@@ -3525,11 +3525,12 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def)
...
@@ -3525,11 +3525,12 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def)
if
(
system_type
==
HMC
)
if
(
system_type
==
HMC
)
virBufferAsprintf
(
&
buf
,
" -m %s"
,
managed_system
);
virBufferAsprintf
(
&
buf
,
" -m %s"
,
managed_system
);
virBufferAsprintf
(
&
buf
,
" -r lpar -p %s -i min_mem=%lld,desired_mem=%lld,"
virBufferAsprintf
(
&
buf
,
" -r lpar -p %s -i min_mem=%lld,desired_mem=%lld,"
"max_mem=%lld,desired_procs=%
d
,virtual_scsi_adapters=%s"
,
"max_mem=%lld,desired_procs=%
u
,virtual_scsi_adapters=%s"
,
def
->
name
,
def
->
mem
.
cur_balloon
,
def
->
name
,
def
->
mem
.
cur_balloon
,
def
->
mem
.
cur_balloon
,
def
->
mem
.
cur_balloon
,
virDomainDefGetMemoryInitial
(
def
),
virDomainDefGetMemoryInitial
(
def
),
(
int
)
def
->
vcpus
,
virDomainDiskGetSource
(
def
->
disks
[
0
]));
virDomainDefGetVcpus
(
def
),
virDomainDiskGetSource
(
def
->
disks
[
0
]));
ret
=
phypExecBuffer
(
session
,
&
buf
,
&
exit_status
,
conn
,
false
);
ret
=
phypExecBuffer
(
session
,
&
buf
,
&
exit_status
,
conn
,
false
);
if
(
exit_status
<
0
)
{
if
(
exit_status
<
0
)
{
...
...
src/qemu/qemu_command.c
浏览文件 @
71c89ac9
...
@@ -7959,7 +7959,7 @@ qemuBuildSmpArgStr(const virDomainDef *def,
...
@@ -7959,7 +7959,7 @@ qemuBuildSmpArgStr(const virDomainDef *def,
{
{
virBuffer
buf
=
VIR_BUFFER_INITIALIZER
;
virBuffer
buf
=
VIR_BUFFER_INITIALIZER
;
virBufferAsprintf
(
&
buf
,
"%u"
,
def
->
vcpus
);
virBufferAsprintf
(
&
buf
,
"%u"
,
virDomainDefGetVcpus
(
def
)
);
if
(
virQEMUCapsGet
(
qemuCaps
,
QEMU_CAPS_SMP_TOPOLOGY
))
{
if
(
virQEMUCapsGet
(
qemuCaps
,
QEMU_CAPS_SMP_TOPOLOGY
))
{
if
(
virDomainDefHasVcpusOffline
(
def
))
if
(
virDomainDefHasVcpusOffline
(
def
))
...
...
src/qemu/qemu_driver.c
浏览文件 @
71c89ac9
...
@@ -2659,7 +2659,7 @@ qemuDomainGetInfo(virDomainPtr dom,
...
@@ -2659,7 +2659,7 @@ qemuDomainGetInfo(virDomainPtr dom,
}
}
}
}
if (VIR_ASSIGN_IS_OVERFLOW(info->nrVirtCpu, v
m->def->vcpus
)) {
if (VIR_ASSIGN_IS_OVERFLOW(info->nrVirtCpu, v
irDomainDefGetVcpus(vm->def)
)) {
virReportError(VIR_ERR_OVERFLOW, "%s", _("cpu count too large"));
virReportError(VIR_ERR_OVERFLOW, "%s", _("cpu count too large"));
goto cleanup;
goto cleanup;
}
}
...
@@ -4700,7 +4700,7 @@ qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
...
@@ -4700,7 +4700,7 @@ qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
size_t i;
size_t i;
int rc = 1;
int rc = 1;
int ret = -1;
int ret = -1;
int oldvcpus = v
m->def->vcpus
;
int oldvcpus = v
irDomainDefGetVcpus(vm->def)
;
int vcpus = oldvcpus;
int vcpus = oldvcpus;
pid_t *cpupids = NULL;
pid_t *cpupids = NULL;
int ncpupids;
int ncpupids;
...
@@ -4929,11 +4929,11 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
...
@@ -4929,11 +4929,11 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
if (!qemuDomainAgentAvailable(vm, true))
if (!qemuDomainAgentAvailable(vm, true))
goto endjob;
goto endjob;
if (nvcpus > v
m->def->vcpus
) {
if (nvcpus > v
irDomainDefGetVcpus(vm->def)
) {
virReportError(VIR_ERR_INVALID_ARG,
virReportError(VIR_ERR_INVALID_ARG,
_("requested vcpu count is greater than the count "
_("requested vcpu count is greater than the count "
"of enabled vcpus in the domain: %d > %d"),
"of enabled vcpus in the domain: %d > %d"),
nvcpus, v
m->def->vcpus
);
nvcpus, v
irDomainDefGetVcpus(vm->def)
);
goto endjob;
goto endjob;
}
}
...
@@ -4972,8 +4972,8 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
...
@@ -4972,8 +4972,8 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
if (persistentDef) {
if (persistentDef) {
/* remove vcpupin entries for vcpus that were unplugged */
/* remove vcpupin entries for vcpus that were unplugged */
if (nvcpus <
persistentDef->vcpus
) {
if (nvcpus <
virDomainDefGetVcpus(persistentDef)
) {
for (i =
persistentDef->vcpus
- 1; i >= nvcpus; i--)
for (i =
virDomainDefGetVcpus(persistentDef)
- 1; i >= nvcpus; i--)
virDomainPinDel(&persistentDef->cputune.vcpupin,
virDomainPinDel(&persistentDef->cputune.vcpupin,
&persistentDef->cputune.nvcpupin,
&persistentDef->cputune.nvcpupin,
i);
i);
...
@@ -5067,17 +5067,17 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
...
@@ -5067,17 +5067,17 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
priv = vm->privateData;
priv = vm->privateData;
if (def && vcpu >=
def->vcpus
) {
if (def && vcpu >=
virDomainDefGetVcpus(def)
) {
virReportError(VIR_ERR_INVALID_ARG,
virReportError(VIR_ERR_INVALID_ARG,
_("vcpu %d is out of range of live cpu count %d"),
_("vcpu %d is out of range of live cpu count %d"),
vcpu,
def->vcpus
);
vcpu,
virDomainDefGetVcpus(def)
);
goto endjob;
goto endjob;
}
}
if (persistentDef && vcpu >=
persistentDef->vcpus
) {
if (persistentDef && vcpu >=
virDomainDefGetVcpus(persistentDef)
) {
virReportError(VIR_ERR_INVALID_ARG,
virReportError(VIR_ERR_INVALID_ARG,
_("vcpu %d is out of range of persistent cpu count %d"),
_("vcpu %d is out of range of persistent cpu count %d"),
vcpu,
persistentDef->vcpus
);
vcpu,
virDomainDefGetVcpus(persistentDef)
);
goto endjob;
goto endjob;
}
}
...
@@ -5246,8 +5246,8 @@ qemuDomainGetVcpuPinInfo(virDomainPtr dom,
...
@@ -5246,8 +5246,8 @@ qemuDomainGetVcpuPinInfo(virDomainPtr dom,
priv = vm->privateData;
priv = vm->privateData;
/* Clamp to actual number of vcpus */
/* Clamp to actual number of vcpus */
if (ncpumaps >
def->vcpus
)
if (ncpumaps >
virDomainDefGetVcpus(def)
)
ncpumaps =
def->vcpus
;
ncpumaps =
virDomainDefGetVcpus(def)
;
if (ncpumaps < 1)
if (ncpumaps < 1)
goto cleanup;
goto cleanup;
...
@@ -5561,7 +5561,7 @@ qemuDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
...
@@ -5561,7 +5561,7 @@ qemuDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
if (flags & VIR_DOMAIN_VCPU_MAXIMUM)
if (flags & VIR_DOMAIN_VCPU_MAXIMUM)
ret = virDomainDefGetVcpusMax(def);
ret = virDomainDefGetVcpusMax(def);
else
else
ret =
def->vcpus
;
ret =
virDomainDefGetVcpus(def)
;
}
}
...
@@ -10587,7 +10587,7 @@ qemuGetVcpusBWLive(virDomainObjPtr vm,
...
@@ -10587,7 +10587,7 @@ qemuGetVcpusBWLive(virDomainObjPtr vm,
goto cleanup;
goto cleanup;
if (*quota > 0)
if (*quota > 0)
*quota /= v
m->def->vcpus
;
*quota /= v
irDomainDefGetVcpus(vm->def)
;
goto out;
goto out;
}
}
...
@@ -19073,7 +19073,7 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
...
@@ -19073,7 +19073,7 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
&record->nparams,
&record->nparams,
maxparams,
maxparams,
"vcpu.current",
"vcpu.current",
(unsigned) dom->def->vcpus
) < 0)
virDomainDefGetVcpus(dom->def)
) < 0)
return -1;
return -1;
if (virTypedParamsAddUInt(&record->params,
if (virTypedParamsAddUInt(&record->params,
...
@@ -19083,17 +19083,17 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
...
@@ -19083,17 +19083,17 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
virDomainDefGetVcpusMax(dom->def)) < 0)
virDomainDefGetVcpusMax(dom->def)) < 0)
return -1;
return -1;
if (VIR_ALLOC_N(cpuinfo,
dom->def->vcpus
) < 0)
if (VIR_ALLOC_N(cpuinfo,
virDomainDefGetVcpus(dom->def)
) < 0)
return -1;
return -1;
if (qemuDomainHelperGetVcpus(dom, cpuinfo,
dom->def->vcpus
,
if (qemuDomainHelperGetVcpus(dom, cpuinfo,
virDomainDefGetVcpus(dom->def)
,
NULL, 0) < 0) {
NULL, 0) < 0) {
virResetLastError();
virResetLastError();
ret = 0; /* it's ok to be silent and go ahead */
ret = 0; /* it's ok to be silent and go ahead */
goto cleanup;
goto cleanup;
}
}
for (i = 0; i <
dom->def->vcpus
; i++) {
for (i = 0; i <
virDomainDefGetVcpus(dom->def)
; i++) {
snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
"vcpu.%zu.state", i);
"vcpu.%zu.state", i);
if (virTypedParamsAddInt(&record->params,
if (virTypedParamsAddInt(&record->params,
...
...
src/qemu/qemu_process.c
浏览文件 @
71c89ac9
...
@@ -2020,11 +2020,11 @@ qemuProcessDetectVcpuPIDs(virQEMUDriverPtr driver,
...
@@ -2020,11 +2020,11 @@ qemuProcessDetectVcpuPIDs(virQEMUDriverPtr driver,
return
0
;
return
0
;
}
}
if
(
ncpupids
!=
v
m
->
def
->
vcpus
)
{
if
(
ncpupids
!=
v
irDomainDefGetVcpus
(
vm
->
def
)
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"got wrong number of vCPU pids from QEMU monitor. "
_
(
"got wrong number of vCPU pids from QEMU monitor. "
"got %d, wanted %d"
),
"got %d, wanted %d"
),
ncpupids
,
v
m
->
def
->
vcpus
);
ncpupids
,
v
irDomainDefGetVcpus
(
vm
->
def
)
);
VIR_FREE
(
cpupids
);
VIR_FREE
(
cpupids
);
return
-
1
;
return
-
1
;
}
}
...
@@ -2240,7 +2240,7 @@ qemuProcessSetVcpuAffinities(virDomainObjPtr vm)
...
@@ -2240,7 +2240,7 @@ qemuProcessSetVcpuAffinities(virDomainObjPtr vm)
int
n
;
int
n
;
int
ret
=
-
1
;
int
ret
=
-
1
;
VIR_DEBUG
(
"Setting affinity on CPUs nvcpupin=%zu nvcpus=%d nvcpupids=%d"
,
VIR_DEBUG
(
"Setting affinity on CPUs nvcpupin=%zu nvcpus=%d nvcpupids=%d"
,
def
->
cputune
.
nvcpupin
,
def
->
vcpus
,
priv
->
nvcpupids
);
def
->
cputune
.
nvcpupin
,
virDomainDefGetVcpus
(
def
)
,
priv
->
nvcpupids
);
if
(
!
def
->
cputune
.
nvcpupin
)
if
(
!
def
->
cputune
.
nvcpupin
)
return
0
;
return
0
;
...
@@ -2259,7 +2259,7 @@ qemuProcessSetVcpuAffinities(virDomainObjPtr vm)
...
@@ -2259,7 +2259,7 @@ qemuProcessSetVcpuAffinities(virDomainObjPtr vm)
return
0
;
return
0
;
}
}
for
(
n
=
0
;
n
<
def
->
vcpus
;
n
++
)
{
for
(
n
=
0
;
n
<
virDomainDefGetVcpus
(
def
)
;
n
++
)
{
/* set affinity only for existing vcpus */
/* set affinity only for existing vcpus */
if
(
!
(
pininfo
=
virDomainPinFind
(
def
->
cputune
.
vcpupin
,
if
(
!
(
pininfo
=
virDomainPinFind
(
def
->
cputune
.
vcpupin
,
def
->
cputune
.
nvcpupin
,
def
->
cputune
.
nvcpupin
,
...
@@ -4670,7 +4670,7 @@ qemuProcessLaunch(virConnectPtr conn,
...
@@ -4670,7 +4670,7 @@ qemuProcessLaunch(virConnectPtr conn,
* either <vcpu> or <numatune> is 'auto'.
* either <vcpu> or <numatune> is 'auto'.
*/
*/
if
(
virDomainDefNeedsPlacementAdvice
(
vm
->
def
))
{
if
(
virDomainDefNeedsPlacementAdvice
(
vm
->
def
))
{
nodeset
=
virNumaGetAutoPlacementAdvice
(
v
m
->
def
->
vcpus
,
nodeset
=
virNumaGetAutoPlacementAdvice
(
v
irDomainDefGetVcpus
(
vm
->
def
)
,
virDomainDefGetMemoryActual
(
vm
->
def
));
virDomainDefGetMemoryActual
(
vm
->
def
));
if
(
!
nodeset
)
if
(
!
nodeset
)
goto
cleanup
;
goto
cleanup
;
...
...
src/test/test_driver.c
浏览文件 @
71c89ac9
...
@@ -1928,7 +1928,7 @@ static int testDomainGetInfo(virDomainPtr domain,
...
@@ -1928,7 +1928,7 @@ static int testDomainGetInfo(virDomainPtr domain,
info
->
state
=
virDomainObjGetState
(
privdom
,
NULL
);
info
->
state
=
virDomainObjGetState
(
privdom
,
NULL
);
info
->
memory
=
privdom
->
def
->
mem
.
cur_balloon
;
info
->
memory
=
privdom
->
def
->
mem
.
cur_balloon
;
info
->
maxMem
=
virDomainDefGetMemoryActual
(
privdom
->
def
);
info
->
maxMem
=
virDomainDefGetMemoryActual
(
privdom
->
def
);
info
->
nrVirtCpu
=
privdom
->
def
->
vcpus
;
info
->
nrVirtCpu
=
virDomainDefGetVcpus
(
privdom
->
def
)
;
info
->
cpuTime
=
((
tv
.
tv_sec
*
1000ll
*
1000ll
*
1000ll
)
+
(
tv
.
tv_usec
*
1000ll
));
info
->
cpuTime
=
((
tv
.
tv_sec
*
1000ll
*
1000ll
*
1000ll
)
+
(
tv
.
tv_usec
*
1000ll
));
ret
=
0
;
ret
=
0
;
...
@@ -2316,7 +2316,7 @@ testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
...
@@ -2316,7 +2316,7 @@ testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
if
(
flags
&
VIR_DOMAIN_VCPU_MAXIMUM
)
if
(
flags
&
VIR_DOMAIN_VCPU_MAXIMUM
)
ret
=
virDomainDefGetVcpusMax
(
def
);
ret
=
virDomainDefGetVcpusMax
(
def
);
else
else
ret
=
def
->
vcpus
;
ret
=
virDomainDefGetVcpus
(
def
)
;
cleanup:
cleanup:
virDomainObjEndAPI
(
&
vm
);
virDomainObjEndAPI
(
&
vm
);
...
@@ -2448,8 +2448,8 @@ static int testDomainGetVcpus(virDomainPtr domain,
...
@@ -2448,8 +2448,8 @@ static int testDomainGetVcpus(virDomainPtr domain,
virBitmapSetAll
(
allcpumap
);
virBitmapSetAll
(
allcpumap
);
/* Clamp to actual number of vcpus */
/* Clamp to actual number of vcpus */
if
(
maxinfo
>
privdom
->
def
->
vcpus
)
if
(
maxinfo
>
virDomainDefGetVcpus
(
privdom
->
def
)
)
maxinfo
=
privdom
->
def
->
vcpus
;
maxinfo
=
virDomainDefGetVcpus
(
privdom
->
def
)
;
memset
(
info
,
0
,
sizeof
(
*
info
)
*
maxinfo
);
memset
(
info
,
0
,
sizeof
(
*
info
)
*
maxinfo
);
memset
(
cpumaps
,
0
,
maxinfo
*
maplen
);
memset
(
cpumaps
,
0
,
maxinfo
*
maplen
);
...
@@ -2507,7 +2507,7 @@ static int testDomainPinVcpu(virDomainPtr domain,
...
@@ -2507,7 +2507,7 @@ static int testDomainPinVcpu(virDomainPtr domain,
goto
cleanup
;
goto
cleanup
;
}
}
if
(
vcpu
>
privdom
->
def
->
vcpus
)
{
if
(
vcpu
>
virDomainDefGetVcpus
(
privdom
->
def
)
)
{
virReportError
(
VIR_ERR_INVALID_ARG
,
"%s"
,
virReportError
(
VIR_ERR_INVALID_ARG
,
"%s"
,
_
(
"requested vcpu is higher than allocated vcpus"
));
_
(
"requested vcpu is higher than allocated vcpus"
));
goto
cleanup
;
goto
cleanup
;
...
@@ -2561,8 +2561,8 @@ testDomainGetVcpuPinInfo(virDomainPtr dom,
...
@@ -2561,8 +2561,8 @@ testDomainGetVcpuPinInfo(virDomainPtr dom,
virBitmapSetAll
(
allcpumap
);
virBitmapSetAll
(
allcpumap
);
/* Clamp to actual number of vcpus */
/* Clamp to actual number of vcpus */
if
(
ncpumaps
>
def
->
vcpus
)
if
(
ncpumaps
>
virDomainDefGetVcpus
(
def
)
)
ncpumaps
=
def
->
vcpus
;
ncpumaps
=
virDomainDefGetVcpus
(
def
)
;
for
(
vcpu
=
0
;
vcpu
<
ncpumaps
;
vcpu
++
)
{
for
(
vcpu
=
0
;
vcpu
<
ncpumaps
;
vcpu
++
)
{
virDomainPinDefPtr
pininfo
;
virDomainPinDefPtr
pininfo
;
...
...
src/uml/uml_driver.c
浏览文件 @
71c89ac9
...
@@ -1916,7 +1916,7 @@ static int umlDomainGetInfo(virDomainPtr dom,
...
@@ -1916,7 +1916,7 @@ static int umlDomainGetInfo(virDomainPtr dom,
info
->
maxMem
=
virDomainDefGetMemoryActual
(
vm
->
def
);
info
->
maxMem
=
virDomainDefGetMemoryActual
(
vm
->
def
);
info
->
memory
=
vm
->
def
->
mem
.
cur_balloon
;
info
->
memory
=
vm
->
def
->
mem
.
cur_balloon
;
info
->
nrVirtCpu
=
v
m
->
def
->
vcpus
;
info
->
nrVirtCpu
=
v
irDomainDefGetVcpus
(
vm
->
def
)
;
ret
=
0
;
ret
=
0
;
cleanup:
cleanup:
...
...
src/vmware/vmware_driver.c
浏览文件 @
71c89ac9
...
@@ -1142,7 +1142,7 @@ vmwareDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
...
@@ -1142,7 +1142,7 @@ vmwareDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
info
->
cpuTime
=
0
;
info
->
cpuTime
=
0
;
info
->
maxMem
=
virDomainDefGetMemoryActual
(
vm
->
def
);
info
->
maxMem
=
virDomainDefGetMemoryActual
(
vm
->
def
);
info
->
memory
=
vm
->
def
->
mem
.
cur_balloon
;
info
->
memory
=
vm
->
def
->
mem
.
cur_balloon
;
info
->
nrVirtCpu
=
v
m
->
def
->
vcpus
;
info
->
nrVirtCpu
=
v
irDomainDefGetVcpus
(
vm
->
def
)
;
ret
=
0
;
ret
=
0
;
cleanup:
cleanup:
...
...
src/vmx/vmx.c
浏览文件 @
71c89ac9
...
@@ -1540,13 +1540,14 @@ virVMXParseConfig(virVMXContext *ctx,
...
@@ -1540,13 +1540,14 @@ virVMXParseConfig(virVMXContext *ctx,
}
}
if
(
sched_cpu_shares
!=
NULL
)
{
if
(
sched_cpu_shares
!=
NULL
)
{
unsigned
int
vcpus
=
virDomainDefGetVcpus
(
def
);
/* See http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.SharesInfo.Level.html */
/* See http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.SharesInfo.Level.html */
if
(
STRCASEEQ
(
sched_cpu_shares
,
"low"
))
{
if
(
STRCASEEQ
(
sched_cpu_shares
,
"low"
))
{
def
->
cputune
.
shares
=
def
->
vcpus
*
500
;
def
->
cputune
.
shares
=
vcpus
*
500
;
}
else
if
(
STRCASEEQ
(
sched_cpu_shares
,
"normal"
))
{
}
else
if
(
STRCASEEQ
(
sched_cpu_shares
,
"normal"
))
{
def
->
cputune
.
shares
=
def
->
vcpus
*
1000
;
def
->
cputune
.
shares
=
vcpus
*
1000
;
}
else
if
(
STRCASEEQ
(
sched_cpu_shares
,
"high"
))
{
}
else
if
(
STRCASEEQ
(
sched_cpu_shares
,
"high"
))
{
def
->
cputune
.
shares
=
def
->
vcpus
*
2000
;
def
->
cputune
.
shares
=
vcpus
*
2000
;
}
else
if
(
virStrToLong_ul
(
sched_cpu_shares
,
NULL
,
10
,
}
else
if
(
virStrToLong_ul
(
sched_cpu_shares
,
NULL
,
10
,
&
def
->
cputune
.
shares
)
<
0
)
{
&
def
->
cputune
.
shares
)
<
0
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
...
@@ -3233,12 +3234,13 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
...
@@ -3233,12 +3234,13 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
/* def:cputune.shares -> vmx:sched.cpu.shares */
/* def:cputune.shares -> vmx:sched.cpu.shares */
if
(
def
->
cputune
.
sharesSpecified
)
{
if
(
def
->
cputune
.
sharesSpecified
)
{
unsigned
int
vcpus
=
virDomainDefGetVcpus
(
def
);
/* See http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.SharesInfo.Level.html */
/* See http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.SharesInfo.Level.html */
if
(
def
->
cputune
.
shares
==
def
->
vcpus
*
500
)
{
if
(
def
->
cputune
.
shares
==
vcpus
*
500
)
{
virBufferAddLit
(
&
buffer
,
"sched.cpu.shares =
\"
low
\"\n
"
);
virBufferAddLit
(
&
buffer
,
"sched.cpu.shares =
\"
low
\"\n
"
);
}
else
if
(
def
->
cputune
.
shares
==
def
->
vcpus
*
1000
)
{
}
else
if
(
def
->
cputune
.
shares
==
vcpus
*
1000
)
{
virBufferAddLit
(
&
buffer
,
"sched.cpu.shares =
\"
normal
\"\n
"
);
virBufferAddLit
(
&
buffer
,
"sched.cpu.shares =
\"
normal
\"\n
"
);
}
else
if
(
def
->
cputune
.
shares
==
def
->
vcpus
*
2000
)
{
}
else
if
(
def
->
cputune
.
shares
==
vcpus
*
2000
)
{
virBufferAddLit
(
&
buffer
,
"sched.cpu.shares =
\"
high
\"\n
"
);
virBufferAddLit
(
&
buffer
,
"sched.cpu.shares =
\"
high
\"\n
"
);
}
else
{
}
else
{
virBufferAsprintf
(
&
buffer
,
"sched.cpu.shares =
\"
%lu
\"\n
"
,
virBufferAsprintf
(
&
buffer
,
"sched.cpu.shares =
\"
%lu
\"\n
"
,
...
...
src/vz/vz_driver.c
浏览文件 @
71c89ac9
...
@@ -560,14 +560,14 @@ vzDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
...
@@ -560,14 +560,14 @@ vzDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
info
->
state
=
virDomainObjGetState
(
privdom
,
NULL
);
info
->
state
=
virDomainObjGetState
(
privdom
,
NULL
);
info
->
memory
=
privdom
->
def
->
mem
.
cur_balloon
;
info
->
memory
=
privdom
->
def
->
mem
.
cur_balloon
;
info
->
maxMem
=
virDomainDefGetMemoryActual
(
privdom
->
def
);
info
->
maxMem
=
virDomainDefGetMemoryActual
(
privdom
->
def
);
info
->
nrVirtCpu
=
privdom
->
def
->
vcpus
;
info
->
nrVirtCpu
=
virDomainDefGetVcpus
(
privdom
->
def
)
;
info
->
cpuTime
=
0
;
info
->
cpuTime
=
0
;
if
(
virDomainObjIsActive
(
privdom
))
{
if
(
virDomainObjIsActive
(
privdom
))
{
unsigned
long
long
vtime
;
unsigned
long
long
vtime
;
size_t
i
;
size_t
i
;
for
(
i
=
0
;
i
<
privdom
->
def
->
vcpus
;
++
i
)
{
for
(
i
=
0
;
i
<
virDomainDefGetVcpus
(
privdom
->
def
)
;
++
i
)
{
if
(
prlsdkGetVcpuStats
(
privdom
,
i
,
&
vtime
)
<
0
)
{
if
(
prlsdkGetVcpuStats
(
privdom
,
i
,
&
vtime
)
<
0
)
{
virReportError
(
VIR_ERR_OPERATION_FAILED
,
"%s"
,
virReportError
(
VIR_ERR_OPERATION_FAILED
,
"%s"
,
_
(
"cannot read cputime for domain"
));
_
(
"cannot read cputime for domain"
));
...
@@ -1374,7 +1374,7 @@ vzDomainGetVcpusFlags(virDomainPtr dom,
...
@@ -1374,7 +1374,7 @@ vzDomainGetVcpusFlags(virDomainPtr dom,
if
(
flags
&
VIR_DOMAIN_VCPU_MAXIMUM
)
if
(
flags
&
VIR_DOMAIN_VCPU_MAXIMUM
)
ret
=
virDomainDefGetVcpusMax
(
privdom
->
def
);
ret
=
virDomainDefGetVcpusMax
(
privdom
->
def
);
else
else
ret
=
privdom
->
def
->
vcpus
;
ret
=
virDomainDefGetVcpus
(
privdom
->
def
)
;
cleanup:
cleanup:
if
(
privdom
)
if
(
privdom
)
...
...
src/vz/vz_sdk.c
浏览文件 @
71c89ac9
...
@@ -1958,7 +1958,7 @@ prlsdkCheckUnsupportedParams(PRL_HANDLE sdkdom, virDomainDefPtr def)
...
@@ -1958,7 +1958,7 @@ prlsdkCheckUnsupportedParams(PRL_HANDLE sdkdom, virDomainDefPtr def)
}
}
if
(
def
->
cputune
.
vcpupin
)
{
if
(
def
->
cputune
.
vcpupin
)
{
for
(
i
=
0
;
i
<
def
->
vcpus
;
i
++
)
{
for
(
i
=
0
;
i
<
virDomainDefGetVcpus
(
def
)
;
i
++
)
{
if
(
!
virBitmapEqual
(
def
->
cpumask
,
if
(
!
virBitmapEqual
(
def
->
cpumask
,
def
->
cputune
.
vcpupin
[
i
]
->
cpumask
))
{
def
->
cputune
.
vcpupin
[
i
]
->
cpumask
))
{
virReportError
(
VIR_ERR_CONFIG_UNSUPPORTED
,
virReportError
(
VIR_ERR_CONFIG_UNSUPPORTED
,
...
@@ -3501,7 +3501,7 @@ prlsdkDoApplyConfig(virConnectPtr conn,
...
@@ -3501,7 +3501,7 @@ prlsdkDoApplyConfig(virConnectPtr conn,
pret
=
PrlVmCfg_SetRamSize
(
sdkdom
,
virDomainDefGetMemoryActual
(
def
)
>>
10
);
pret
=
PrlVmCfg_SetRamSize
(
sdkdom
,
virDomainDefGetMemoryActual
(
def
)
>>
10
);
prlsdkCheckRetGoto
(
pret
,
error
);
prlsdkCheckRetGoto
(
pret
,
error
);
pret
=
PrlVmCfg_SetCpuCount
(
sdkdom
,
def
->
vcpus
);
pret
=
PrlVmCfg_SetCpuCount
(
sdkdom
,
virDomainDefGetVcpus
(
def
)
);
prlsdkCheckRetGoto
(
pret
,
error
);
prlsdkCheckRetGoto
(
pret
,
error
);
if
(
!
(
mask
=
virBitmapFormat
(
def
->
cpumask
)))
if
(
!
(
mask
=
virBitmapFormat
(
def
->
cpumask
)))
...
...
src/xen/xm_internal.c
浏览文件 @
71c89ac9
...
@@ -483,7 +483,7 @@ xenXMDomainGetInfo(virConnectPtr conn,
...
@@ -483,7 +483,7 @@ xenXMDomainGetInfo(virConnectPtr conn,
memset
(
info
,
0
,
sizeof
(
virDomainInfo
));
memset
(
info
,
0
,
sizeof
(
virDomainInfo
));
info
->
maxMem
=
virDomainDefGetMemoryActual
(
entry
->
def
);
info
->
maxMem
=
virDomainDefGetMemoryActual
(
entry
->
def
);
info
->
memory
=
entry
->
def
->
mem
.
cur_balloon
;
info
->
memory
=
entry
->
def
->
mem
.
cur_balloon
;
info
->
nrVirtCpu
=
entry
->
def
->
vcpus
;
info
->
nrVirtCpu
=
virDomainDefGetVcpus
(
entry
->
def
)
;
info
->
state
=
VIR_DOMAIN_SHUTOFF
;
info
->
state
=
VIR_DOMAIN_SHUTOFF
;
info
->
cpuTime
=
0
;
info
->
cpuTime
=
0
;
...
@@ -765,7 +765,7 @@ xenXMDomainGetVcpusFlags(virConnectPtr conn,
...
@@ -765,7 +765,7 @@ xenXMDomainGetVcpusFlags(virConnectPtr conn,
if
(
flags
&
VIR_DOMAIN_VCPU_MAXIMUM
)
if
(
flags
&
VIR_DOMAIN_VCPU_MAXIMUM
)
ret
=
virDomainDefGetVcpusMax
(
entry
->
def
);
ret
=
virDomainDefGetVcpusMax
(
entry
->
def
);
else
else
ret
=
entry
->
def
->
vcpus
;
ret
=
virDomainDefGetVcpus
(
entry
->
def
)
;
cleanup:
cleanup:
xenUnifiedUnlock
(
priv
);
xenUnifiedUnlock
(
priv
);
...
...
src/xenapi/xenapi_utils.c
浏览文件 @
71c89ac9
...
@@ -506,7 +506,7 @@ createVMRecordFromXml(virConnectPtr conn, virDomainDefPtr def,
...
@@ -506,7 +506,7 @@ createVMRecordFromXml(virConnectPtr conn, virDomainDefPtr def,
if
(
virDomainDefGetVcpusMax
(
def
)
>
0
)
{
if
(
virDomainDefGetVcpusMax
(
def
)
>
0
)
{
(
*
record
)
->
vcpus_max
=
(
int64_t
)
virDomainDefGetVcpusMax
(
def
);
(
*
record
)
->
vcpus_max
=
(
int64_t
)
virDomainDefGetVcpusMax
(
def
);
(
*
record
)
->
vcpus_at_startup
=
(
int64_t
)
def
->
vcpus
;
(
*
record
)
->
vcpus_at_startup
=
(
int64_t
)
virDomainDefGetVcpus
(
def
)
;
}
}
if
(
def
->
onPoweroff
)
if
(
def
->
onPoweroff
)
(
*
record
)
->
actions_after_shutdown
=
actionShutdownLibvirt2XenapiEnum
(
def
->
onPoweroff
);
(
*
record
)
->
actions_after_shutdown
=
actionShutdownLibvirt2XenapiEnum
(
def
->
onPoweroff
);
...
...
src/xenconfig/xen_common.c
浏览文件 @
71c89ac9
...
@@ -1537,7 +1537,8 @@ xenFormatCPUAllocation(virConfPtr conf, virDomainDefPtr def)
...
@@ -1537,7 +1537,8 @@ xenFormatCPUAllocation(virConfPtr conf, virDomainDefPtr def)
/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
either 32, or 64 on a platform where long is big enough. */
either 32, or 64 on a platform where long is big enough. */
if
(
virDomainDefHasVcpusOffline
(
def
)
&&
if
(
virDomainDefHasVcpusOffline
(
def
)
&&
xenConfigSetInt
(
conf
,
"vcpu_avail"
,
(
1UL
<<
def
->
vcpus
)
-
1
)
<
0
)
xenConfigSetInt
(
conf
,
"vcpu_avail"
,
(
1UL
<<
virDomainDefGetVcpus
(
def
))
-
1
)
<
0
)
goto
cleanup
;
goto
cleanup
;
if
((
def
->
cpumask
!=
NULL
)
&&
if
((
def
->
cpumask
!=
NULL
)
&&
...
...
src/xenconfig/xen_sxpr.c
浏览文件 @
71c89ac9
...
@@ -2246,7 +2246,8 @@ xenFormatSxpr(virConnectPtr conn,
...
@@ -2246,7 +2246,8 @@ xenFormatSxpr(virConnectPtr conn,
/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
either 32, or 64 on a platform where long is big enough. */
either 32, or 64 on a platform where long is big enough. */
if
(
virDomainDefHasVcpusOffline
(
def
))
if
(
virDomainDefHasVcpusOffline
(
def
))
virBufferAsprintf
(
&
buf
,
"(vcpu_avail %lu)"
,
(
1UL
<<
def
->
vcpus
)
-
1
);
virBufferAsprintf
(
&
buf
,
"(vcpu_avail %lu)"
,
(
1UL
<<
virDomainDefGetVcpus
(
def
))
-
1
);
if
(
def
->
cpumask
)
{
if
(
def
->
cpumask
)
{
char
*
ranges
=
virBitmapFormat
(
def
->
cpumask
);
char
*
ranges
=
virBitmapFormat
(
def
->
cpumask
);
...
@@ -2329,7 +2330,7 @@ xenFormatSxpr(virConnectPtr conn,
...
@@ -2329,7 +2330,7 @@ xenFormatSxpr(virConnectPtr conn,
virBufferAsprintf
(
&
buf
,
"(vcpus %u)"
,
virDomainDefGetVcpusMax
(
def
));
virBufferAsprintf
(
&
buf
,
"(vcpus %u)"
,
virDomainDefGetVcpusMax
(
def
));
if
(
virDomainDefHasVcpusOffline
(
def
))
if
(
virDomainDefHasVcpusOffline
(
def
))
virBufferAsprintf
(
&
buf
,
"(vcpu_avail %lu)"
,
virBufferAsprintf
(
&
buf
,
"(vcpu_avail %lu)"
,
(
1UL
<<
def
->
vcpus
)
-
1
);
(
1UL
<<
virDomainDefGetVcpus
(
def
)
)
-
1
);
for
(
i
=
0
;
i
<
def
->
os
.
nBootDevs
;
i
++
)
{
for
(
i
=
0
;
i
<
def
->
os
.
nBootDevs
;
i
++
)
{
switch
(
def
->
os
.
bootDevs
[
i
])
{
switch
(
def
->
os
.
bootDevs
[
i
])
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录