当前位置:网站首页>KVM virtualization management tool

KVM virtualization management tool

2022-06-13 05:11:00 I love Qianxi

One 、 What is Cloud Computing ?

Cloud computing is a pay as you go model , The bottom layer of cloud computing is realized through virtualization technology .

2、 Service types of Cloud Computing

a、IAAS Infrastructure as a service ( It mainly provides virtual machines , Ali cloud, esc amount to IAAS layer ,openstack It can be realized esc function )
b、PAAS Platform as a service ( Provide installed software environment )
c、SAAS Software as a service (cdn service )

 Insert picture description here
3、 Why Cloud Computing ?

A small company : The physical server also needs idc Computer room , Server costs , Bandwidth cost, etc , The virtual machine costs less than the virtual machine , If the enterprise does not need so many servers , Directly release the virtual machine , But the physical server cannot be returned , The risk of virtual machine is small , You can use it right away , High expansion flexibility .
A large company : For example, Jingdong 618, User traffic is soaring , It is impossible to buy so many servers all over the country ,618 After a while , The number of users has decreased , Then the server will be idle , Idle server resources are rented out , Oversold calculation .

Two 、 The foundation of Cloud Computing KVM virtualization

1、 What is virtualization ?

Hardware through analog computer , To run multiple different operating systems on the same computer at the same time .

2、 The difference between virtualization software :

a、qemu Rely on software to simulate hardware , Fully virtualized software , Particularly slow , Compatibility is good. .
b、xen redhat 5.5 Used to xen,5.5 Later, it was replaced by kvm,xen Very good performance , A specially modified kernel is required , Compatibility is poor .
c、KVM Hardware support cpu, Based on the kernel , There is no need to use a dedicated kernel , Good performance , Good compatibility , It combines the above two advantages .

3、 ... and 、 install kvm Virtualization management tools

KVM:Kernel-based Virtual Machine Kernel based virtualization tools

1、 install kvm Tools needed

yum install qemu-kvm qemu-img libvirt libvirt-python libvirt-client virt-install virt-viewer –y

**libvirt:**kvm Virtual machine management software
**virt-install:** Virtual machine installation tools
**qemu-kvm qemu-img(qcow2,raw):** Manage virtual disks for virtual machines

start-up libvirt And set the power on self starting

[[email protected] ~]# systemctl start libvirtd [[email protected] ~]# systemctl enable libvirtd

2、 Environmental requirements
Centos7 System +2G Memory +cpu Turn on Virtualization
 Insert picture description here
3、 Install one kvm virtual machine
1、 First, create two directories to store iso Files and generated qcow2 Disk files

[[email protected] ~]# mkdir /home/iso   # The directory where the image is stored 
[[email protected] ~]# mkdir /home/images    # The directory where the disk files are stored 

2、 Here we choose vnc Methods of connecting virtual machines

install VNC server/VNC client , Use VNC Connecting virtual machines

yum -y install tigervnc-server tigervnc vnc vnc-server

Set the password required for remote login
Input vncserver You will be prompted to enter the password
notes : This password is required for remote login
 Insert picture description here

Press the following command to connect to the virtual machine

virt-install --name=nebula --virt-type=kvm --memory 800,maxmemory=1024 --vcpus 1 --cdrom=/home/iso/CentOS-7-x86_64-Minimal-1708.iso --disk path=/home/images/nebula.qcow2,size=10 --network bridge=br0 --graphicsvnc --vncport=15950 --vnclisten=0.0.0.0 --noautoconsole --autostart

Command interpretation :

virt-install : Virtual machine installation tools
- -virt-type=kvm: The type of virtualization
- -name=nebula: The name of the virtual machine
- -memory 800 : Virtual machine memory ( Because the image I uploaded is 792M Of , So give it 800M Memory )
maxmemory=1024: Maximum memory
- -vcpus 1 fictitious cpu The number of nuclear
--cdrom=/home/iso/CentOS-7-x86_64-Minimal-1708.iso : The location of the image
- -disk path=/home/images/nebula.qcow2,size=10 : The directory where the disk files are stored , And the size of the disk type , The size is 10G
- -network network=default : Use default NAT The Internet
- -graphics vnc --vncport=15950 --vnclisten=0.0.0.0 : The default display is vnc, Specify port number
- -noautoconsole --autostart : Yes, but not

The above configurations correspond to the virtual machine configurations
 Insert picture description here
In order to improve the performance of virtual machines , None swap Partition .
Here's through vnc Connect to the virtual machine page
 Insert picture description here

Four 、virsh Daily operation of virtual machine ( switch , Suspend virtual machine , Import configuration file , Disk capacity increase , Convert disk format, etc )

1、 List the running virtual machines

[[email protected] images]# virsh list
 Id    Name                           State
----------------------------------------------------

2、 Start virtual machine

[[email protected] images]# virsh start nebula1
Domain nebula1 started

3、 List all virtual machines ( Running or shut down )

[[email protected] images]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     nebula1                        shut off

4、 If executed shutdown however vnc Your virtual machine is still running , At this time, it is necessary to forcibly shut down ( Unplug power and turn off , Data will be lost )

[[email protected] images]# virsh destroy nebula1

5、 Restart the virtual machine

[[email protected] images]# virsh reboot nebula1

6、 View the configuration file

[[email protected] images]# virsh dumpxml  nebula1

Write the configuration file to a file , You can see the memory ,cpu, Disk, etc .

[[email protected] images]# virsh dumpxml nebula1>>nebula1.xml

As long as there are disk files + The configuration file , Virtual machines can be migrated to any computer , Import the configuration file into , You can migrate to other hosts

[[email protected] images]# virsh define nebula1.xml

7、 Delete virtual machine (undefine The essence of is to delete .xml file )

[[email protected] images]# virsh undefine nebula1

How to restore the deleted virtual machine ? Just restore the previously imported configuration file , The order is as follows :

[[email protected] images]# virsh define nebula1.xml

Again virsh list You can see that nebula1 了 .

The following command , There are several xml Files represent several virtual machines

[[email protected] images]# ls /etc/libvirt/qemu
autostart  nebula1.xml  networks

use ps -ef |grep qemu You can see the disk contents of the running virtual machine .

8、 If df-h See that the disk is almost full , You can install the virtual machine to another directory

[[email protected] images]# mkdir /data
[[email protected] images]# mv  mv nebula1.qcow2 /data/

Again virsh start nebula1 Will make mistakes :

[[email protected] images]# virsh start nebula1
error: Failed to start domain nebula1
error: Cannot access storage file '/home/images/nebula1.qcow2' (as uid:107, gid:107): No such file or directory

Because we have moved the disk files , So the disk file cannot be found at startup , This is the path where we modify the disk file in the configuration file ,cd /etc/libvirt/qemu, virsh edit nebula1, Search for disk, Change the disk path to data, Restart to start successfully .

[[email protected] images]# cd /etc/libvirt/qemu
[[email protected] images]# ls /etc/libvirt/qemu
autostart  nebula1.xml  networks
[[email protected] images]# virsh edit nebula1( In fact, that is vim nebula1.xml, But for the sake of safety , The configuration file allows us to select this modification method )
  <driver name='qemu' type='qcow2'/>
  <source file='/data/nebula1.qcow2'/>

9、 rename : The name of our virtual machine should let us know what service this virtual machine runs , So the name should be clear at a glance :

[[email protected] images]# virsh domrename nebula1 web-blog

take nebula1 Change your name to blog web service , It is not allowed to rename when the machine is turned on .

10、 Suspend virtual machine

[[email protected] qemu]# virsh suspend nebula1
Domain nebula1 suspended

[[email protected] qemu]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 9     nebula1                        paused

11、 Restore the state

[[email protected] qemu]# virsh resume nebula1
Domain nebula1 resumed

[[email protected] qemu]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 9     nebula1                        running

12、 see vnc Port number

[[email protected] ~]# virsh vncdisplay nebula1
:10050

13、 Set up kvm Boot from boot , In order not to affect the business

[[email protected] ~]# virsh autostart nebula1    ### Set power on self start 
Domain nebula1 marked as autostarted

[[email protected] ~]# virsh list --all                ### Look at the state 
 Id    Name                           State
----------------------------------------------------
 -     nebula1                        shut off

[[email protected] ~]# systemctl restart libvirtd    ### start-up libvirtd
[[email protected] ~]# virsh list --all              ###nebula1 It also starts up automatically 
 Id    Name                           State
----------------------------------------------------
 1     nebula1                        running

14、 See who is the machine that starts up automatically

[[email protected] ~]# cd /etc/libvirt/qemu
[[email protected] qemu]# ls       ### See a autostart, It is the directory of startup and self startup 
autostart  nebula1.xml  networks
[[email protected] qemu]# cd autostart/       ### Go to this directory , See which ones are self starting 
[[email protected] autostart]# ls                    ### notice nebula1 Yes, it is set to start automatically 
nebula1.xml
[[email protected] autostart]# ll -h nebula1.xml        ### This is a soft link file , If you delete the source file , So even if it is set to start automatically , It won't start either 
lrwxrwxrwx 1 root root 29 May  1 15:15 nebula1.xml -> /etc/libvirt/qemu/nebula1.xml
[[email protected] autostart]# ln -s /etc/libvirt/qemu/nebula1.xml /etc/libvirt/qemu/autostart    # If the boot auto start is not set , You can also make soft links to it directly 

15、 Cancel power on, auto start :

[[email protected] autostart]# virsh autostart --disable nebula1
Domain nebula1 unmarked as autostarted
[[email protected] autostart]# ls   ### There is no content in this directory , In essence, it removes the soft links 
[[email protected] autostart]#

16、 Go to the console page of the command line version :( Can replace vnc,console Sign in )

[[email protected] autostart]# virsh console nebula1
Connected to domain nebula1
Escape character is ^]           ### use ^ and  ] Before you can withdraw , Long press Ctrl+]
[[email protected] autostart]#

Change kvm The kernel parameters of the virtual machine :

[[email protected] ~]# grubby --update-kernel=ALL --args="console=ttyS0,115200n8"
reboot, Must restart to be effective 

After reboot virsh console nebula1 You can enter the login interface
 Insert picture description here

17、kvm Virtual machine virtual disk format conversion :

raw: Naked format , Large space , How much space is directly occupied , Snapshot is not supported , Good performance , Inconvenient transmission ;
qcow2:cow(copy on write), Give as much memory as you need , Not all at once , Small footprint , Support for snapshots , Performance ratio raw It's almost , Convenient transmission .

Common commands for virtual machine disk tools :

qemu -img info,create,resize,covert

18、 Check if it is a disk file ( With this order qemu -img info)

[[email protected] data]# ls
nebula1.qcow2

[[email protected] data]# qemu-img info nebula1.qcow2
image: nebula1.qcow2
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 1.3G
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: true

19、 Create a block of size 1G Of qcow2 Virtual disk in format :

[[email protected] data]# qemu-img create -f qcow2 /data/ll.qcow2 1G
image: ll.qcow2
file format: qcow2
virtual size: 1.0G (1073741824 bytes)

20、 Adjust disk capacity ( Adding 1G Capacity )

[[email protected] data]# qemu-img resize /data/ll.qcow2 +1G
Image resized.
[[email protected] data]# ll -h ll.qcow2
-rw-r--r-- 1 root root 257K May  1 16:44 ll.qcow2
[[email protected] data]# qemu-img info ll.qcow2
image: ll.qcow2
file format: qcow2
virtual size: 2.0G (2147483648 bytes)            ### You can see that the memory consists of 1G Added to 2G(qcow2 Disks in this format can only be added but not subtracted ,raw The format of the disk can be reduced )

21、 to raw Disk shrinkage ( Do not shrink the volume in production , Data will be lost !!!) Can only expand !!! Don't shrink !!!

[[email protected] data]# qemu-img info liyu.raw
image: liyu.raw
file format: raw
virtual size: 2.0G (2147483648 bytes)     ### You can see that it was 2G Memory 

 Subtract... From it 1G Memory :
[[email protected] data]# qemu-img resize liyu.raw -1G
Image resized.
[[email protected] data]# qemu-img info liyu.raw
image: liyu.raw
file format: raw
virtual size: 1.0G (1073741824 bytes)       ### Shrink volume successfully 

22、 Convert format :

[[email protected] data]# qemu-img convert -f raw -O qcow2 liyu.raw liyu.qcow2  #-f Specify the raw Format , Turn into -O,qcow2 Format , Followed by two files to be converted 
[[email protected] data]# ll -h
total 1.3G
-rw-r--r-- 1 root root 193K May  1 17:03 liyu.qcow2
-rw-r--r-- 1 root root 1.0G May  1 16:50 liyu.raw
-rw------- 1 qemu qemu  11G May  1 17:03 nebula1.qcow2

After format conversion , The configuration file must be modified to take effect :( With liyu give an example )

[[email protected] data]# virsh  edit   liyu
 modify disk Inside raw by qcow2, modify type Of raw by qcow2. Two changes 
 Open it again :
[[email protected] data]# virsh start liyu

qcow2 Is a copy on write disk format , You write to this disk 2G The content of ,ll -h Look, it adds 2G, If you feel like taking up space , Deleted 2G The content of , Again df -h see , Originally added 2G Memory is still there , because qcow2 Format files can only be added , Can't reduce .

5、 ... and 、 The snapshot management

Create a snapshot :( The snapshot will be saved in the disk file , So every time you create a snapshot , The memory of disk files will become larger and larger )

[[email protected] ~]# virsh snapshot-create nebula1
Domain snapshot 1619861008 created
[[email protected] ~]# virsh snapshot-list nebula1
 Name                 Creation Time             State
------------------------------------------------------------
 1619861008           2021-05-01 17:23:28 +0800 running
 
[[email protected] ~]# date +%s  # listed above 1619861008 by unix Time stamp ( distance 1970 year 0 branch 0 How many seconds have passed ), and date +%s It's about the same time 
1619861052

Delete snapshot :

[[email protected] ~]# virsh snapshot-delete nebula1 --snapshotname  1619861008
Domain snapshot 1619861008 deleted

We don't want to name the snapshot after a timestamp , For example, you want to take the snapshot name after the installation environment is configured , You can take the following command :

[[email protected] ~]# virsh snapshot-create-as --name env_ok nebula1
Domain snapshot env_ok created
[[email protected] ~]# virsh snapshot-list nebula1
 Name                 Creation Time             State
------------------------------------------------------------
 env_ok               2021-05-01 17:34:11 +0800  running

Restore snapshot : For example, we accidentally deleted the root , We can restore snapshots :

[[email protected] ~]# virsh snapshot-revert nebula1  --snapshotname env_ok

6、 ... and 、KVM Cloning of virtual machines

1、 Complete cloning

 Insert picture description here
Pure automatic cloning

-o Specify the old virtual machine ,-n Specify a new virtual machine

[[email protected] ~]# virt-clone --auto-clone -o nebula1 -n backup
WARNING  Setting the graphics device port to autoport, in order to avoid confli                                                 cting.
WARNING  The requested volume capacity will exceed the available pool space whe                                                 n the volume is fully allocated. (10240 M requested capacity > 4194 M available                                                 )
Allocating 'backup.qcow2'                                  |  10 GB  00:08

Clone 'backup' created successfully.

Then you can see the cloned virtual machine , Disk files are stored in the same location as the cloned virtual machine

[[email protected] ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     backup                         shut off
 -     nebula1                        shut off

[[email protected] ~]# virsh dumpxml backup|grep -i 'qcow2'
      <driver name='qemu' type='qcow2'/>
      <source file='/data/backup.qcow2'/>

2、 Link Clone

Link cloning is not pure automatic cloning , So you have to clone it manually , Manual cloning requires Disk file plus configuration file , Automatic cloning we can write a script as follows .

The disk file is created as follows :

[[email protected] data]# qemu-img create -f qcow2 -b nebula1.qcow2 web01.qcow2
Formatting 'web01.qcow2', fmt=qcow2 size=10737418240 backing_file='nebula1.qcow2' encryption=off cluster_size=65536 lazy_refcounts=off
[[email protected] data]# ll -h    # You can see that it takes up very little space 
total 2.9G
-rw------- 1 root root 1.3G May  4 17:46 backup.qcow2
-rw------- 1 root root  11G May  4 17:42 nebula1.qcow2
-rw-r--r-- 1 root root 193K May  4 18:30 web01.qcow2

[[email protected] data]# qemu-img info web01.qcow2
image: web01.qcow2
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 196K
cluster_size: 65536
backing file: nebula1.qcow2    # The source clone file is nebula1.qcow2
Format specific information:
    compat: 1.1
    lazy refcounts: false

The configuration file is created as follows :

[[email protected] data]# virsh dumpxml nebula1 >> web01.xml  # Look for any one xml Import the file to the newly cloned virtual machine 
[[email protected] data]# ls
backup.qcow2  nebula1.qcow2  web01.qcow2  web01.xml
[[email protected] data]# vim web01.xml  # Modify the configuration file 
 <name>web01</name>
 <source file='/data/web01.qcow2'/>
 <graphics type='vnc' port='15954' autoport='no' listen='0.0.0.0'>
# Because we created nebula1 The port number is specified , Therefore, the port number here should also be modified , Otherwise, there will be conflicts 
 then uuid and mac Delete both lines of the address , At startup, the system will regenerate new uuid and mac Address 

Then import the configuration file , To start the

[[email protected] data]# virsh define web01.xml
Domain web01 defined from web01.xml

[[email protected] data]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     backup                         shut off
 -     nebula1                        shut off
 -     web01                          shut off

[[email protected] data]# virsh start web01
Domain web01 started

Fully automatic linking and cloning of virtual machine scripts

 Insert picture description here

[[email protected] scripts]# sh conle-vm.sh centos7 test
Domain test defined from /tmp/test.xml

Domain test started

The fully automatic link cloning script is written

7、 ... and 、kvm Bridge mode of virtual machine

If you use NAT Pattern , The web page will not be found in the browser , And a new network segment will be generated , Use bridge mode without port mapping , Direct connection , Assigned to the virtual machine ip It is also the host network segment .

In the installation kvm The virtual machine should also specify the network as the bridge mode –network bridge=br0
1、 Create a bridging pattern

virsh iface-bridge ens33 br0

2、 Cancel bridge mode

virsh iface-unbridge br0

3、 You can also modify the network card configuration file , But I think the first method is easier
This is ens33 Network card configuration content of
 Insert picture description here
This is a bridge network virbr0 Configuration file for
 Insert picture description here

8、 ... and 、 Hot addition technology

The so-called hot add is to add when the machine is turned on

1、 Online hot add hard disk ( Including temporary , Permanently add and remove hard disks )

First give nebula1 Disk plus 5G Capacity

[[email protected] data]# qemu-img create -f qcow2 nebula1-add.qcow2 5G

Then create the disk ( Source virtual machine , Source virtual machine disk path , Target disk )

[[email protected] data]# virsh attach-disk nebula1 /data/nebula1-add.qcow2 vdb
Disk attached successfully

here vdb The disk has been added successfully , stay kvm Execute in the virtual machine fdisk -l You can see the added disks
 Insert picture description here
But why did you just add 5G Content ,vdb It shows 0MB Well ? Because the disk type must be specified when adding a hard disk , Do not specify default as raw type ,qcow2 Your disk will not display raw The size of the disk , So now we need to peel off the added hard disk , Use the following command :( Temporarily peel off the hard disk ), To permanently peel off a hard disk, it is the same as adding a hard disk permanently , add - -config Parameters

[[email protected] data]# virsh detach-disk nebula1 vdb
Disk detached successfully

Then specify the type of hard disk to be added as qcow2, Add the last parameter

[[email protected] images]# virsh attach-disk nebula1 /data/nebula1-add.qcow2 vdb --subdriver qcow2
Disk attached successfully

Now go on to kvm In the virtual machine fdisk -l You can see the just added 5G The capacity of the hard disk is
 Insert picture description here
however ! After we forced the shutdown , Start up again and enter kvm After the virtual machine , The added hard disk is missing again , because This is just a temporary addition , Therefore, if we want the hard disk to be permanently added after boot, we have to permanently add it , Add the following parameters .

[[email protected] images]# virsh attach-disk nebula1 /data/nebula1-add.qcow2 vdb --subdriver qcow2 --config

- -config This parameter will not take effect until the next restart .

If you want to use this added disk, you have to format it (mkfs.xfs /dev/vdb), Mount it again , see
 Insert picture description here

2、 Online expansion

During the expansion , You must uninstall the hard disk you just mounted

umount /mnt

Also peel off the hard disk you just added

[[email protected] images]# virsh detach-disk nebula1 vdb
Disk detached successfully

Then expand its capacity and view it , Disk capacity has been added by us 5G Turn into 8G 了

[[email protected] images]# qemu-img resize /data/nebula1-add.qcow2 +3G
Image resized.
[[email protected] images]# qemu-img info /data/nebula1-add.qcow2
image: /data/nebula1-add.qcow2
file format: qcow2
virtual size: 8.0G (8589934592 bytes)
disk size: 16M
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false

Now add the disk

[[email protected] images]# virsh attach-disk nebula1 /data/nebula1-add.qcow2 vdb --subd                                                 river qcow2
Disk attached successfully

And then kvm Mount the disk of the virtual machine , We see that the previously copied files are not lost , however df -h When you see the disk or 5G, Not updated to 8G
 Insert picture description here
Why? ? Because we have specified in the format inode and block size ( Superblock ), But our expansion disk is in the back , So I have to update it Superblock information
 Insert picture description here
Update the superblock information with the following command , You can see block The information has been updated

 Insert picture description here
Again df -h see , from 5G become 8G 了
 Insert picture description here
If it is ext3/ext4 file system , Then use resize2fs /dev/vdb To update
The idea of capacity expansion :
 Insert picture description here

3、 Online hot add network card ( Including removing the network card )

add to - -model virtio Parameters , The additional network cards come in order ,eth0,eth1

[[email protected] ~]# virsh attach-interface nebula1 --type bridge --source virbr0 --model virtio
Interface attached successfully

stay kvm You can view in the virtual machine IP, See the new network card eth1
 Insert picture description here
Remove the network card :

[[email protected] images]# virsh detach-interface nebula1 --type bridge
error: Domain has 2 interfaces. Please specify which one to detach using --mac
error: Failed to detach interface

Removing the network card in the above way will prompt that there are two interfaces bridge type , You need to specify the mac Address for removal , See the picture above eth1 Of mac The address is 52:54:00:2f:f2:5f, So add mac Parameters

[[email protected] images]# virsh detach-interface nebula1 --type bridge --mac 52:54:00:                                                 2f:f2:5f
Interface detached successfully

You can see kvm In the virtual machine eth1 be without , The network card was removed successfully
 Insert picture description here
This is only a temporary modification , To be effective permanently, you have to add - -config Parameters

4、 Online hot add memory

Note that the installation has just started Kvm The virtual machine should specify the existing memory and the maximum memory , It is convenient to add memory in the future

virt-install --name=nebula --virt-type=kvm --memory 800,maxmemory=1024 --vcpus 1 --cdrom=/home/iso/CentOS-7-x86_64-Minimal-1708.iso --disk path=/home/images/nebula.qcow2,size=10 --network bridge=br0 --graphicsvnc --vncport=15950 --vnclisten=0.0.0.0 --noautoconsole --autostart

The command to add memory is as follows

[[email protected] images]# virsh setmem nebula1 1024M

stay kvm Check the memory capacity in the virtual machine , You can see the increase
 Insert picture description here
But if we install kvm The virtual machine does not specify the maximum memory , Then you need to enter the configuration file to modify , You can change the unit to MIB, When the saved file is entered again, the system will automatically convert the unit to KB

[[email protected] images]# vim nebula1.xml
 <memory unit='KiB'>1048576</memory>
 <currentMemory unit='KiB'>819200</currentMemory>

If the modified virtual machine is running , The modified configuration file will not take effect , Restart is required to take effect .

5、 Online hot add cpu

Use the following command to install kvm When it comes to virtual machines , You can add cpu Information , Maximum cpu Number

virt-install --name=nebula --virt-type=kvm --memory 800,maxmemory=1024  --vcpus 1,maxvcpus=10 --cdrom=/home/iso/CentOS-7-x86_64-Minimal-1708.iso --disk path=/home/images/nebula.qcow2,size=10 --network bridge=br0 --graphicsvnc --vncport=15950 --vnclisten=0.0.0.0 --noautoconsole --autostart

And then set CPU Number , take nebula1 Of CPU Adjusted for 2

[[email protected] images]# virsh setvcpus nebula1 2

Again lscpu You can see two cpu 了 , It turned out that there was only 0, Now it is 0 and 1
 Insert picture description here
that cpu You can add , Can I reduce it ? Let's try that , You can see the previous cpu The number is 6, Now it's set to 2, Prompt does not support CPU Recycling
 Insert picture description here

6、kvm Hot migration of virtual machines

See the next article , I can't write this one down

原网站

版权声明
本文为[I love Qianxi]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202280515161278.html