libvirt/tests/qemuxml2argvdata/hostdev-mdev-duplicate.xml
Shalini Chellathurai Saroja 9c3b6b7a82 conf: verify for duplicate hostdevs
It is possible to define/edit(in shut off state) a domain XML with
same hostdev device repeated more than once, as shown below. This
behavior is not expected. So, this patch fixes it.

vser1:
<domain type='kvm'>
[...]
  <devices>
 [...]
    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-ccw'>
      <source>
        <address uuid='8e782fea-e5f4-45fa-a0f9-024cf66e5009'/>
      </source>
      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0005'/>
    </hostdev>
    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-ccw'>
      <source>
        <address uuid='8e782fea-e5f4-45fa-a0f9-024cf66e5009'/>
      </source>
      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0006'/>
    </hostdev>
[...]
  </devices>
</domain>

$ virsh define vser1
Domain 'vser1' defined from vser1

Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-01 16:34:03 +02:00

42 lines
1.5 KiB
XML

<domain type='qemu'>
<name>QEMUGuest2</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-i386</emulator>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci'>
<source>
<address uuid='53764d0e-85a0-42b4-af5c-2046b460b1dc'/>
</source>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</hostdev>
<hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci'>
<source>
<address uuid='53764d0e-85a0-42b4-af5c-2046b460b1dc'/>
</source>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
</hostdev>
<memballoon model='none'/>
</devices>
</domain>