标签:load core 修改 color 详细 rsh inf lazy systemctl
以下命令行亲自执行有效,执行环境:
Compiled against library: libvirt 4.5.0
Using library: libvirt 4.5.0
Using API: QEMU 4.5.0
Running hypervisor: QEMU 1.5.3
加到4处理器、2内核、8线程
查看 CPU 物理个数
grep ‘physical id‘ /proc/cpuinfo | sort -u | wc -l
查看 CPU 核心数量
grep ‘core id‘ /proc/cpuinfo | sort -u | wc -l
查看 CPU 线程数
grep ‘processor‘ /proc/cpuinfo | sort -u | wc -l
查看 CPU 型号
dmidecode -s processor-version
查看 CPU 的详细信息:
cat /proc/cpuinfo
结果
[root@hadoop001 qemu]# grep ‘physical id‘ /proc/cpuinfo | sort -u | wc -l 4 [root@hadoop001 qemu]# grep ‘core id‘ /proc/cpuinfo | sort -u | wc -l 2 [root@hadoop001 qemu]# grep ‘processor‘ /proc/cpuinfo | sort -u | wc -l 8 [root@hadoop001 qemu]# dmidecode -s processor-version Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz
查看centos7.xml,找到cpu的配置,目前是默认配置
查看配置文件:/etc/libvirt/qemu/这个目录下保存已经安装虚拟机的信息
<name>centos7</name> <uuid>6f0b80d9-4e1a-4d19-97d4-79459e5985d8</uuid> <memory unit=‘KiB‘>1048576</memory> <currentMemory unit=‘KiB‘>1048576</currentMemory> <vcpu placement=‘static‘>1</vcpu> 最后一行的意思是静态的1个cpu,修改为2个 <vcpu placement=‘auto‘ current=‘2‘>2</vcpu>
启动或者重启虚拟机
virsh start centos7
virsh reboot centos7
动态不关机情况下修改为2个:
virsh setvcpus centos7 2
咦,vnc连不上了,原来是忘记了防火墙,先关闭
systemctl stop firewalld
查看下cpu数量
virsh vcpucount centos7
查看下cpu详细情况
virsh vcpuinfo centos7
在虚拟机里运行
grep ‘processor‘ /proc/cpuinfo | sort -u | wc -l
看来配置已经起效了,处理器和线程都变成了2个了。
标签:load core 修改 color 详细 rsh inf lazy systemctl
原文地址:https://www.cnblogs.com/starcrm/p/13287147.html