2. Short name of guest. It consists of letters and numbers and cannot contain spaces
dcs01
3. uuid, generated by the command line tool uuidgen.
e5fff551-bbe1-e748-c8e4-8ecb3bffb902
4. The maximum memory that the guest can use without rebooting the guest, in KB.
1048576
5. The memory when the guest starts can be passed Use virsh setmem to adjust the memory, but it cannot be larger than the maximum usable memory.
1048576
6. Assigned virtual cpu
1
7. Related OS architecture: i686, x86_64 machine: host operating system boot: Specify the boot device. You can repeat multiple lines and specify different values as a boot device list.
hvm
8. Processor features
9. Clock. Use local time: localtime
10. Define the default actions when power off, reboot, or crash in the kvm environment are destroy and restart respectively. Other allowed actions include: preserve, rename-restart. destroy: Stop the virtual machine. Equivalent to turning off the power. restartRestart the virtual machine.
destroyrestartrestart
11. Start of device definition
12. Simulation element, the writing method here is used for guest
/usr/libexec/qemu-kvm
13. File used for kvm storage. In this example, it appears as an IDE device in the guest. Use the qemu-img command to create this file. The default directory of kvm image is: /var/lib/libvirt/images/
Supplement: Multiple disks can be defined. Use virtio: Use an ordinary driver, that is, when both the hard disk and the network card adopt the default configuration, the network card works under the simulated rtl 8139 network card, and the speed is 100M full duplex. After using the virtio driver, the network card works in 1000M mode.
Use an ordinary driver, that is, when both the hard disk and the network card adopt the default configuration, the hard disk is in IDE mode. After using the virtio driver, the hard disk works in SCSI mode.
CD-ROM device:
14. Use the bridge type. Make sure each kvm guest's mac address is unique. A tun device will be created with the name vnetx (x is 0,1,2...)
Supplement: Use the default virtual network instead of the bridge, that is, the guest is in NAT mode. You can also omit the mac address element, so the mac address will be automatically generated.
The address 192.168.122.x/24 is assigned by default, and can also be specified manually. The gateway is 192.168.122.1
Use virtio: Use an ordinary driver, that is, when the hard disk and network card are both configured in the default configuration, the network card works under the simulated rtl 8139 network card, with a speed of 100M. duplex. After using the virtio driver, the network card works in 1000M mode.
15. Input device
16. Define the graphics device that interacts with guset. In this example, the vnc protocol is used. The address of listen is the address of host. prot is -1, which means the port number is automatically assigned. Use the following command to find the port number: virsh vncdisplay 33e1e9ce7395ccd8e6281087cf15dba5
#The destination mirror path in this example, Shown as IDE device in guest.
#Virtual machine network connection method
## Use virtio: Use an ordinary driver, that is, when both the hard disk and the network card adopt the default configuration, the hard disk is in ide mode, and the network card works under the simulated rtl 8139 network card, with a speed of 100M full duplex . After using the virtio driver, the network card works in 1000M mode, and the hard disk works in SCSI mode.
#Log in with vnc, the port number is automatically assigned. You can query [vncdisplay domainId] through virsh vncdisplay
unconfined_u:object_r:svirt_image_t:s0:c362,c396
The above is the detailed content of Detailed explanation of the configuration xml code in the KVM virtual machine. For more information, please follow other related articles on the PHP Chinese website!
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn