问题出现的情况:
一,使用在高版本kvm安装的虚拟机的配置xml文件,该虚拟机启动的时候报错如下:
[root@centos1 ~]# virsh create centos.xml error: Failed to create domain from centos.xml error: internal error: process exited while connecting to monitor: qemu-kvm: -machine pc-i440fx-rhel7.6.0,accel=kvm,usb=off,dump-guest-core=off: Unsupported machine type Use -machine help to list supported machines! [root@centos1 ~]# systemctl status libvirtd ● libvirtd.service - Virtualization daemon Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2022-05-09 20:41:10 CST; 1min 18s ago Docs: man:libvirtd(8) https://libvirt.org Main PID: 1620 (libvirtd) Tasks: 19 (limit: 32768) CGroup: /system.slice/libvirtd.service ├─1286 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelpe... ├─1287 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelpe... └─1620 /usr/sbin/libvirtd May 09 20:41:16 centos1 libvirtd[1620]: 2022-05-09 12:41:16.846+0000: 1623: info : hostname: centos1 May 09 20:41:16 centos1 libvirtd[1620]: 2022-05-09 12:41:16.846+0000: 1623: error : qemuMonitorOpenUnix:379 : failed to connect to monitor ... process May 09 20:41:16 centos1 libvirtd[1620]: 2022-05-09 12:41:16.846+0000: 1623: error : qemuProcessReportLogError:1924 : internal error: proces...ine type May 09 20:41:16 centos1 libvirtd[1620]: Use -machine help to list supported machines! May 09 20:41:23 centos1 libvirtd[1620]: 2022-05-09 12:41:23.493+0000: 1623: error : qemuMonitorOpenUnix:379 : failed to connect to monitor ... process May 09 20:41:23 centos1 libvirtd[1620]: 2022-05-09 12:41:23.493+0000: 1623: error : qemuProcessReportLogError:1924 : internal error: proces...ine type May 09 20:41:23 centos1 libvirtd[1620]: Use -machine help to list supported machines! May 09 20:42:19 centos1 libvirtd[1620]: 2022-05-09 12:42:19.295+0000: 1623: error : qemuMonitorOpenUnix:379 : failed to connect to monitor ... process May 09 20:42:19 centos1 libvirtd[1620]: 2022-05-09 12:42:19.295+0000: 1623: error : qemuProcessReportLogError:1924 : internal error: proces...ine type May 09 20:42:19 centos1 libvirtd[1620]: Use -machine help to list supported machines! Hint: Some lines were ellipsized, use -l to show in full.
二,两个版本的对比:
安装虚拟机所使用的kvm版本(注意了,这个版本的kvm需要高版本的内核支持,说人话就是要升级内核才可以正常使用kvm):
[root@centos1 ~]# virsh -c qemu:///system Welcome to virsh, the virtualization interactive terminal. Type: 'help' for help with commands 'quit' to quit virsh # version Compiled against library: libvirt 4.5.0 Using library: libvirt 4.5.0 Using API: QEMU 4.5.0 Running hypervisor: QEMU 2.12.0
上面报错的kvm版本:
[root@centos1 ~]# virsh -c qemu:///system Welcome to virsh, the virtualization interactive terminal. Type: 'help' for help with commands 'quit' to quit virsh # version 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
xml文件的machine标签内内容:
<domain type='kvm'> <name>centos</name> <uuid>a15efb24-5075-46a8-9732-8e489ece5aba</uuid> <memory unit='KiB'>1048576</memory> <currentMemory unit='KiB'>1048576</currentMemory> <vcpu placement='static'>1</vcpu> <os> <type arch='x86_64' machine='pc-i440fx-rhel7.6.0'>hvm</type> <boot dev='hd'/>
三,解决方法:
使用命令/usr/libexec/qemu-kvm -machine help
查看支持的类型
[root@centos1 ~]# /usr/libexec/qemu-kvm -machine help Supported machines are: none empty machine pc RHEL 7.0.0 PC (i440FX + PIIX, 1996) (alias of pc-i440fx-rhel7.0.0) pc-i440fx-rhel7.0.0 RHEL 7.0.0 PC (i440FX + PIIX, 1996) (default) rhel6.6.0 RHEL 6.6.0 PC rhel6.5.0 RHEL 6.5.0 PC rhel6.4.0 RHEL 6.4.0 PC rhel6.3.0 RHEL 6.3.0 PC rhel6.2.0 RHEL 6.2.0 PC rhel6.1.0 RHEL 6.1.0 PC rhel6.0.0 RHEL 6.0.0 PC
发现里面有个alias of pc-i440fx-rhel7.0.0 ,而原文件内是alias of pc-i440fx-rhel7.6.0, 因此,将6改成0,再次启动虚拟机没有报错,此问题彻底解决。
总结:kvm版本需要注意,选择一个合适的kvm版本很重要。