Situation

When Use virsh define vm.xml Get Error Like These

Situation 1

[root@localhost ~]# virsh define vm.xml
error: Failed to define domain from vm.xml
error: Cannot check QEMU binary /usr/bin/qemu-system-x86_64: No such file or directory

Situation 2

error: Failed to define domain from vm.xml
error: unsupported configuration: Emulator '/usr/libexec/qemu-kvm' does not support machine type 'pc-q35-4.2'

[root@localhost ~]# /usr/libexec/qemu-kvm -machine help
Supported machines are:
pc                   RHEL 7.6.0 PC (i440FX + PIIX, 1996) (alias of pc-i440fx-rhel7.6.0)
pc-i440fx-rhel7.6.0  RHEL 7.6.0 PC (i440FX + PIIX, 1996) (default) (deprecated)
q35                  RHEL-9.0.0 PC (Q35 + ICH9, 2009) (alias of pc-q35-rhel9.0.0)
pc-q35-rhel9.0.0     RHEL-9.0.0 PC (Q35 + ICH9, 2009)
pc-q35-rhel8.6.0     RHEL-8.6.0 PC (Q35 + ICH9, 2009) (deprecated)
pc-q35-rhel8.5.0     RHEL-8.5.0 PC (Q35 + ICH9, 2009) (deprecated)
pc-q35-rhel8.4.0     RHEL-8.4.0 PC (Q35 + ICH9, 2009) (deprecated)
pc-q35-rhel8.3.0     RHEL-8.3.0 PC (Q35 + ICH9, 2009) (deprecated)
pc-q35-rhel8.2.0     RHEL-8.2.0 PC (Q35 + ICH9, 2009) (deprecated)
pc-q35-rhel8.1.0     RHEL-8.1.0 PC (Q35 + ICH9, 2009) (deprecated)
pc-q35-rhel8.0.0     RHEL-8.0.0 PC (Q35 + ICH9, 2009) (deprecated)
pc-q35-rhel7.6.0     RHEL-7.6.0 PC (Q35 + ICH9, 2009) (deprecated)
none                 empty machine

Situation 3

error: Failed to define domain from vm.xml
error: unsupported configuration: domain configuration does not support video model 'qxl'

Solution

Solution 1

Change Binary Path

vim vm.xml 

### Find /usr/bin/qemu-system-x86_64 and change to /usr/libexec/qemu-kvm
<emulator>/usr/bin/qemu-system-x86_64</emulator>
### To
<emulator>/usr/libexec/qemu-kvm</emulator>

Solution 2

<os>
    <type arch='x86_64' machine='pc-q35-4.2'>hvm</type>
    <boot dev='hd'/>
</os>

### To

<os>
    <type arch='x86_64' machine='pc-q35-rhel9.0.0'>hvm</type>
    <boot dev='hd'/>
  </os>

Solution 3

<video>
      <model type='vga' vram='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</video>

### To 
<video>
      <model type='vga' vram='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</video>

Change Network Configuration

<interface type='network'>
      <mac address='00:00:00:00:00:00'/>
      <source network='host-bridge'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</interface>
### To
<interface type='bridge'>
    <mac address='00:00:00:00:00:00'/>
    <source bridge='br0'/>
    <model type='virtio'/>
    <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</interface>