【问题标题】:How do I find out how many CPUs (vcpus) my XEN system has?如何找出我的 XEN 系统有多少 CPU (vcpus)?
【发布时间】:2015-07-20 14:53:23
【问题描述】:

如果我启动 top 或查看 /proc/cpuinfo,我只会看到两个 CPU。如果我使用 virt-manager 查看为我的系统显示的值,该工具会显示 32 vcpus(这是我认为正确的值)。

我(还)未能在虚拟机管理程序的脚本级别上找出正确的值 (32)。我一直在研究/proc/cpuinfo/sys/devices/system/cpu/ 以及其他我能想到的东西,但没有发现这个价值。还有像xenxm 这样的shell 命令,我仔细检查了,但没有办法显示我正在寻找的值。

有人知道我如何知道我的 XEN 系统提供了多少 vcpus 吗?

编辑:lscpu 给我:

Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    2
Core(s) per socket:    1
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 45
Stepping:              7
CPU MHz:               2900.086
BogoMIPS:              5800.17
Hypervisor vendor:     Xen
Virtualization type:   none
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              20480K
NUMA node0 CPU(s):     0,1

所以,这也不会在任何地方显示“32”。

/proc/cpuinfo的内容:

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 45
model name  : Intel(R) Xeon(R) CPU E5-2690 0 @ 2.90GHz
stepping    : 7
microcode   : 0x70d
cpu MHz     : 2900.086
cache size  : 20480 KB
physical id : 0
siblings    : 2
core id     : 0
cpu cores   : 1
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu de tsc msr pae cx8 apic sep cmov pat clflush acpi mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nopl nonstop_tsc pni pclmulqdq est ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes hypervisor lahf_lm ida arat pln pts dtherm
bogomips    : 5800.17
clflush size    : 64
cache_alignment : 64
address sizes   : 46 bits physical, 48 bits virtual
power management:

processor   : 1
vendor_id   : GenuineIntel
cpu family  : 6
model       : 45
model name  : Intel(R) Xeon(R) CPU E5-2690 0 @ 2.90GHz
stepping    : 7
microcode   : 0x70d
cpu MHz     : 2900.086
cache size  : 20480 KB
physical id : 0
siblings    : 2
core id     : 0
cpu cores   : 1
apicid      : 1
initial apicid  : 1
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu de tsc msr pae cx8 apic sep cmov pat clflush acpi mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nopl nonstop_tsc pni pclmulqdq est ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes hypervisor lahf_lm ida arat pln pts dtherm
bogomips    : 5800.17
clflush size    : 64
cache_alignment : 64
address sizes   : 46 bits physical, 48 bits virtual
power management:

【问题讨论】:

  • 您是在主机(“Domain-0”)还是在客户机中查看top/proc/cpuinfoxm 绝对有你想要的选项(较新的 xl 也有,libvirts virsh 也是如此) - xm info 显示总物理 CPU 数量,xm vcpu-list 用于访客......跨度>

标签: linux cpu xen hypervisor vcpu


【解决方案1】:

我现在找到了办法:

IFS=: read _ nr_cpus < <(xm info | grep ^nr_cpus)
echo "$nr_cpus"

这将(最终)打印出来

32

在我的系统上。

【讨论】:

    【解决方案2】:

    这是一个不错的方法:

    cat /proc/cpuinfo | grep "core id"
    

    这是一个输出示例:

    core id     : 0
    core id     : 1
    core id     : 0
    core id     : 1
    

    就我而言,系统是双核的,我只有 core-id 0 和 core-id 1。

    【讨论】:

    • 是的,对,正如我已经在我的问题中写的那样,我已经查看了/proc/cpuinfo,但没有成功。它向我显示了两行(均为core id : 0),但我的系统为创建的虚拟机提供了多达 32 个 vcpus。我想知道在哪里可以看到这个数字 32。
    • lscpu 给你什么?你能发布 cat /proc/cpuinfo 的整个输出吗?
    • 我在问题中添加了您要求的内容。不幸的是,没有显示所需的 32。
    • 我猜重点是XEN环境;似乎我只获得了有关我的 XEN 托管节点的信息,而不是有关虚拟机管理程序功能的信息。
    猜你喜欢
    • 1970-01-01
    • 2014-02-06
    • 2018-08-15
    • 1970-01-01
    • 2016-12-09
    • 1970-01-01
    • 2022-06-16
    • 1970-01-01
    • 2017-05-07
    相关资源
    最近更新 更多