GNU/Linux >> LINUX-Kenntnisse >  >> Cent OS

So erhöhen Sie die vCPU-Ressourcen des KVM-Gasts

Dieser Beitrag veranschaulicht die Schritte zum Erhöhen der KVM-Gast-vCPU. Es gibt zwei Methoden, um die Anzahl der KVM-Gast-vCPUs zu erhöhen:spontan und offline. Sehen wir uns die Schritte für jede der folgenden Methoden an.

KVM-Gast-vCPUs online erhöhen

1. Überprüfen Sie die aktuelle KVM-Gast-VCPU/Speicher auf dem KVM-Host:

[root@kvm-host]# virsh dumpxml kvm-guest | grep vcpu
<vcpu placement='static'>1</vcpu>
[root@kvm-host]# virsh dominfo kvm-guest
Id: -
Name: kvm-guest
UUID: 8f6fc48c-a6f4-429d-b77e-88a4b8d3d961
OS Type: hvm
State: shut off
CPU(s): 1
Max memory: 8392704 KiB
Used memory: 8392704 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: selinux
Security DOI: 0

2. Legen Sie die maximalen vCPUs für den KVM-Gast fest. In diesem Beispiel legen wir das Maximum der vCPU der Gast-VM als Wert 2:

fest

[root@kvm-host]# virsh setvcpus kvm-guest 2 --config --maximum

3. Prüfen Sie, ob das Maximum der vCPU-Einstellung wirksam wird. Hier ist das vCPU-XML-Format:

<vcpu placement='static' current='N'>M</vcpu>

Wobei N die aktuell aktivierte Anzahl von CPUs und M die maximale Anzahl von CPUs ist.

[root@kvm-host]# virsh dumpxml kvm-guest | grep -i vcpu
<vcpu placement='static' current='1'>2</vcpu>

4. Erhöhen Sie die vCPU von 1 auf 2 mit dem virsh-Befehl:

[root@kvm-host]# virsh setvcpus kvm-guest 2

5. Überprüfen Sie, ob das Hinzufügen von vCPU abgeschlossen ist:

Vom KVM-Host:

[root@kvm-host]# virsh dominfo kvm-guest
Id: 11
Name: kvm-guest
UUID: 8f6fc48c-a6f4-429d-b77e-88a4b8d3d961
OS Type: hvm
State: running
CPU(s): 2
CPU time: 13.9s
Max memory: 8392704 KiB
Used memory: 8392704 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: selinux
Security DOI: 0
Security label: system_u:system_r:svirt_t:s0:c191,c578 (enforcing)

Von KVM-Gast:

[root@localhost ~]# tail -f /var/log/messages
checking TSC synchronization [CPU#0 -> CPU#1]:
Measured 143005979072 cycles TSC warp between CPUs, turning off TSC clock.
Please try to boot with tscsync
Marking TSC unstable due to check_tsc_sync_source failed
kvm-clock: cpu 1, msr 0:28314b81, secondary cpu clock
[root@localhost ~]# lscpu
Architecture: x86_64
CPU op-mode(s): 64-bit
CPU(s): 2
Thread(s) per core: 1
Core(s) per socket: 1
CPU socket(s): 2

6. Speichern Sie die VM-Konfiguration, wenn Sie diese Änderungen dauerhaft machen möchten.

[root@kvm-host]# virsh setvcpus kvm-guest 2 --config

KVM-Gast-vCPUs offline erhöhen

Diese Methode muss Ausfallzeiten für die Gast-VM arrangieren:

1. Fahren Sie die Gast-VM herunter:

[root@kvm-host]# virsh list
Id Name State
----------------------------------------------------
10 kvm-guest running
[root@kvm-host]# virsh destroy 10
Domain 10 destroyed
[root@kvm-host]# virsh list
Id Name State
----------------------------------------------------

2. Aktualisieren Sie die erforderliche Anzahl von vCPUs:

# virsh edit guest_vm

In diesem Beispiel erhöhen wir die vCPU von 2 auf 4:

[root@j-kvm-host opc]# virsh edit kvm-guest

Von:

<memory unit='KiB'>8392704</memory>
<currentMemory unit='KiB'>8392704</currentMemory>
<vcpu placement='static'>2</vcpu>

An:

<memory unit='KiB'>8392704</memory>
<currentMemory unit='KiB'>8392704</currentMemory>
<vcpu placement='static'>4</vcpu>

3. Booten Sie die Gast-VM und prüfen Sie, ob die Erhöhung der vCPU wirksam wird:

[root@j-kvm-host opc]# virsh start kvm-guest

4. Überprüfen Sie die neuen CPU-Ressourcen:

Vom KVM-Host:

[root@kvm-host]# virsh dominfo kvm-guest
Id: 12
Name: kvm-guest
UUID: 8f6fc48c-a6f4-429d-b77e-88a4b8d3d961
OS Type: hvm
State: running
CPU(s): 4
...

Von KVM-Gast:

[root@localhost ~]# lscpu
Architecture: x86_64
CPU op-mode(s): 64-bit
CPU(s): 4
Thread(s) per core: 1
Core(s) per socket: 1
CPU socket(s): 4
NUMA node(s): 1
Vendor ID: GenuineIntel
... 
So erhöhen Sie die KVM-Gastspeicherressourcen


Cent OS
  1. So installieren Sie Kvm in Ubuntu 20.04

  2. So installieren Sie KVM unter CentOS 8 Linux

  3. So installieren Sie Linux KVM und erstellen eine Gast-VM mit Beispielen

  4. So fügen Sie Arbeitsspeicher, vCPU und Festplatte zu einer virtuellen Linux-KVM-Maschine hinzu

  5. So mounten Sie das Qcow2 Virtual Disk-Image des Gasts, das LVM auf einer KVM-Host-Maschine enthält

So benennen Sie die virtuelle KVM-Gastmaschine um

So aktivieren Sie den Zugriff auf die Virsh-Konsole für KVM-Gäste

So installieren Sie KVM auf Manjaro 21

So installieren Sie KVM unter CentOS 8

Wie kann man das Timeout in Putty erhöhen?

Wie kann die angezeigte Bildschirmauflösung auf QEMU / KVM erhöht werden?