]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Need to assign PCI address to vhost-scsi
authorJohn Ferlan <jferlan@redhat.com>
Tue, 12 Dec 2017 11:30:31 +0000 (06:30 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 13 Dec 2017 20:37:30 +0000 (15:37 -0500)
Commit id '70249927b' neglected to cover this case because the test
had taken the "shortcut" to already add the <address>; however, when
the PCI address assignment code was adjusted by commit id '70249927'
the vhost-scsi (VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST) wasn't
covered thus returning a 0 for pciFlags. So I altered the tests too
to make sure it doesn't happen again.

Previously the qemuxml2xmloutdata was a softlink to the source
qemuxml2argvdata, so I unlinked and recreated the output file to
force generation of the adddress. Without the test changes, an
address generation returns:

    libvirt: Domain Config error : internal error: Cannot automatically
    add a new PCI bus for a device with connect flags 00

if an address was supplied in the test, a restart of libvirtd or
edit of a guest would display the following opaque message:

    warning : qemuDomainCollectPCIAddress:1237 :
    qemuDomainDeviceCalculatePCIConnectFlags() thinks that the device
     with PCI address 0000:00:09.0 should not have a PCI address

where the address is related to the guest PCI address provided.

src/qemu/qemu_domain_address.c
tests/qemuxml2argvdata/hostdev-scsi-vhost-scsi-ccw.xml
tests/qemuxml2argvdata/hostdev-scsi-vhost-scsi-pci.xml
tests/qemuxml2xmloutdata/hostdev-scsi-vhost-scsi-ccw.xml [changed from symlink to file mode: 0644]
tests/qemuxml2xmloutdata/hostdev-scsi-vhost-scsi-pci.xml [changed from symlink to file mode: 0644]

index a40cdb399310af7f9fc22471bd4c5bc4b2a9795c..6e7561d39697ffb8b35a1a553084fdd0176391ed 100644 (file)
@@ -623,7 +623,8 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
 
         if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
             (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
-             hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV)) {
+             hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV &&
+             hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST)) {
             return 0;
         }
 
index 6012d241ceac884872ca53cb75784ded49189716..33234bc3d9c52472dfab4d53ffc182b6970104fa 100644 (file)
@@ -24,7 +24,6 @@
     </controller>
     <hostdev mode='subsystem' type='scsi_host' managed='no'>
       <source protocol='vhost' wwpn='naa.5123456789abcde0'/>
-      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0002'/>
     </hostdev>
     <memballoon model='virtio'>
       <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0003'/>
index cb97544d308659be38fa81bda37be4017715dfbc..13455f672e2b44672df90f754ac462c48194851d 100644 (file)
@@ -33,7 +33,6 @@
     <input type='keyboard' bus='ps2'/>
     <hostdev mode='subsystem' type='scsi_host' managed='no'>
       <source protocol='vhost' wwpn='naa.5123456789abcde0'/>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
     </hostdev>
     <memballoon model='virtio'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
deleted file mode 120000 (symlink)
index 39ff659682e63c0ac00cd2eb991eb343d41fa9aa..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-../qemuxml2argvdata/hostdev-scsi-vhost-scsi-ccw.xml
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6012d241ceac884872ca53cb75784ded49189716
--- /dev/null
@@ -0,0 +1,34 @@
+<domain type='qemu'>
+  <name>QEMUGuest2</name>
+  <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw'>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-s390x</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hda' bus='virtio'/>
+      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+    </disk>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
+    </controller>
+    <hostdev mode='subsystem' type='scsi_host' managed='no'>
+      <source protocol='vhost' wwpn='naa.5123456789abcde0'/>
+      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0002'/>
+    </hostdev>
+    <memballoon model='virtio'>
+      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0003'/>
+    </memballoon>
+    <panic model='s390'/>
+  </devices>
+</domain>
deleted file mode 120000 (symlink)
index b17ea17c8f004646c8ff994d95144cdb49c973d4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-../qemuxml2argvdata/hostdev-scsi-vhost-scsi-pci.xml
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cb97544d308659be38fa81bda37be4017715dfbc
--- /dev/null
@@ -0,0 +1,42 @@
+<domain type='qemu'>
+  <name>QEMUGuest2</name>
+  <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</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-i686</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <hostdev mode='subsystem' type='scsi_host' managed='no'>
+      <source protocol='vhost' wwpn='naa.5123456789abcde0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </hostdev>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>