[libvirt PATCH 2/7] conf: reject unfiltered sgio on validation

Ján Tomko jtomko at redhat.com
Thu Jan 13 17:47:37 UTC 2022


No kernels supported by upstream libvirt have the feature.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/conf/domain_validate.c                    | 11 +++++
 .../disk-scsi-lun-passthrough-sgio.xml        | 35 --------------
 tests/qemuxml2argvdata/hostdev-scsi-rawio.xml | 37 ---------------
 tests/qemuxml2argvdata/hostdev-scsi-sgio.xml  | 37 ---------------
 .../disk-scsi-lun-passthrough-sgio.xml        | 46 ------------------
 .../qemuxml2xmloutdata/hostdev-scsi-rawio.xml | 47 -------------------
 .../qemuxml2xmloutdata/hostdev-scsi-sgio.xml  | 47 -------------------
 tests/qemuxml2xmltest.c                       | 11 -----
 8 files changed, 11 insertions(+), 260 deletions(-)
 delete mode 100644 tests/qemuxml2argvdata/disk-scsi-lun-passthrough-sgio.xml
 delete mode 100644 tests/qemuxml2argvdata/hostdev-scsi-rawio.xml
 delete mode 100644 tests/qemuxml2argvdata/hostdev-scsi-sgio.xml
 delete mode 100644 tests/qemuxml2xmloutdata/disk-scsi-lun-passthrough-sgio.xml
 delete mode 100644 tests/qemuxml2xmloutdata/hostdev-scsi-rawio.xml
 delete mode 100644 tests/qemuxml2xmloutdata/hostdev-scsi-sgio.xml

diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index a4271f1247..e9baf1d41a 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -621,6 +621,12 @@ virDomainDiskDefValidate(const virDomainDef *def,
     if (virDomainDiskDefValidateSource(disk->src) < 0)
         return -1;
 
+    if (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("unfiltered sgio is no longer supported"));
+        return -1;
+    }
+
     /* Validate LUN configuration */
     if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) {
         if (virDomainDiskDefSourceLUNValidate(disk->src) < 0)
@@ -1917,6 +1923,11 @@ virDomainHostdevDefValidate(const virDomainHostdevDef *hostdev)
                                  "address type"));
                 return -1;
             }
+            if (hostdev->source.subsys.u.scsi.sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("unfiltered sgio is no longer supported"));
+                return -1;
+            }
             break;
         case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
             if (hostdev->info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
diff --git a/tests/qemuxml2argvdata/disk-scsi-lun-passthrough-sgio.xml b/tests/qemuxml2argvdata/disk-scsi-lun-passthrough-sgio.xml
deleted file mode 100644
index 3e561642a3..0000000000
--- a/tests/qemuxml2argvdata/disk-scsi-lun-passthrough-sgio.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<domain type='qemu'>
-  <name>QEMUGuest1</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>
-    <disk type='block' device='lun' rawio='no' sgio='unfiltered'>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
-      <target dev='hda' bus='scsi'/>
-      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
-    </disk>
-    <disk type='block' device='lun' sgio='filtered'>
-      <source dev='/dev/HostVG/QEMUGuest2'/>
-      <target dev='hdb' bus='scsi'/>
-      <address type='drive' controller='0' bus='0' target='1' unit='1'/>
-    </disk>
-    <controller type='scsi' index='0' model='virtio-scsi'/>
-    <controller type='scsi' index='1' model='lsilogic'/>
-    <controller type='usb' index='0'/>
-    <controller type='pci' index='0' model='pci-root'/>
-    <input type='mouse' bus='ps2'/>
-    <input type='keyboard' bus='ps2'/>
-    <memballoon model='virtio'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-rawio.xml b/tests/qemuxml2argvdata/hostdev-scsi-rawio.xml
deleted file mode 100644
index eb60e550f0..0000000000
--- a/tests/qemuxml2argvdata/hostdev-scsi-rawio.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<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-i386</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'/>
-    <controller type='usb' index='0'/>
-    <controller type='ide' index='0'/>
-    <controller type='pci' index='0' model='pci-root'/>
-    <input type='mouse' bus='ps2'/>
-    <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes' sgio='unfiltered' rawio='yes'>
-      <source>
-        <adapter name='scsi_host0'/>
-        <address bus='0' target='0' unit='0'/>
-      </source>
-      <address type='drive' controller='0' bus='0' target='4' unit='8'/>
-    </hostdev>
-    <memballoon model='virtio'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-sgio.xml b/tests/qemuxml2argvdata/hostdev-scsi-sgio.xml
deleted file mode 100644
index bfc5346807..0000000000
--- a/tests/qemuxml2argvdata/hostdev-scsi-sgio.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<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-i386</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'/>
-    <controller type='usb' index='0'/>
-    <controller type='ide' index='0'/>
-    <controller type='pci' index='0' model='pci-root'/>
-    <input type='mouse' bus='ps2'/>
-    <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes' sgio='unfiltered'>
-      <source>
-        <adapter name='scsi_host0'/>
-        <address bus='0' target='0' unit='0'/>
-      </source>
-      <address type='drive' controller='0' bus='0' target='4' unit='8'/>
-    </hostdev>
-    <memballoon model='virtio'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2xmloutdata/disk-scsi-lun-passthrough-sgio.xml b/tests/qemuxml2xmloutdata/disk-scsi-lun-passthrough-sgio.xml
deleted file mode 100644
index 2b62595805..0000000000
--- a/tests/qemuxml2xmloutdata/disk-scsi-lun-passthrough-sgio.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<domain type='qemu'>
-  <name>QEMUGuest1</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>
-    <disk type='block' device='lun' rawio='no' sgio='unfiltered'>
-      <driver name='qemu' type='raw'/>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
-      <target dev='hda' bus='scsi'/>
-      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
-    </disk>
-    <disk type='block' device='lun' sgio='filtered'>
-      <driver name='qemu' type='raw'/>
-      <source dev='/dev/HostVG/QEMUGuest2'/>
-      <target dev='hdb' bus='scsi'/>
-      <address type='drive' controller='0' bus='0' target='1' unit='1'/>
-    </disk>
-    <controller type='scsi' index='0' model='virtio-scsi'>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
-    </controller>
-    <controller type='scsi' index='1' model='lsilogic'>
-      <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='pci' index='0' model='pci-root'/>
-    <input type='mouse' bus='ps2'/>
-    <input type='keyboard' bus='ps2'/>
-    <audio id='1' type='none'/>
-    <memballoon model='virtio'>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
-    </memballoon>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-rawio.xml b/tests/qemuxml2xmloutdata/hostdev-scsi-rawio.xml
deleted file mode 100644
index b9f3fc1446..0000000000
--- a/tests/qemuxml2xmloutdata/hostdev-scsi-rawio.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<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-i386</emulator>
-    <disk type='block' device='disk'>
-      <driver name='qemu' type='raw'/>
-      <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='0x02' 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'/>
-    <audio id='1' type='none'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes' sgio='unfiltered' rawio='yes'>
-      <source>
-        <adapter name='scsi_host0'/>
-        <address bus='0' target='0' unit='0'/>
-      </source>
-      <address type='drive' controller='0' bus='0' target='4' unit='8'/>
-    </hostdev>
-    <memballoon model='virtio'>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
-    </memballoon>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-sgio.xml b/tests/qemuxml2xmloutdata/hostdev-scsi-sgio.xml
deleted file mode 100644
index 748d5ac543..0000000000
--- a/tests/qemuxml2xmloutdata/hostdev-scsi-sgio.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<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-i386</emulator>
-    <disk type='block' device='disk'>
-      <driver name='qemu' type='raw'/>
-      <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='0x02' 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'/>
-    <audio id='1' type='none'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes' sgio='unfiltered'>
-      <source>
-        <adapter name='scsi_host0'/>
-        <address bus='0' target='0' unit='0'/>
-      </source>
-      <address type='drive' controller='0' bus='0' target='4' unit='8'/>
-    </hostdev>
-    <memballoon model='virtio'>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
-    </memballoon>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index fb438269b9..68d74fa4f1 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -617,11 +617,6 @@ mymain(void)
                  ARG_END);
     DO_TEST_NOCAPS("numad-static-vcpu-no-numatune");
 
-    DO_TEST("disk-scsi-lun-passthrough-sgio",
-            QEMU_CAPS_SCSI_LSI,
-            QEMU_CAPS_VIRTIO_SCSI,
-            QEMU_CAPS_SCSI_DISK_WWN,
-            QEMU_CAPS_SCSI_BLOCK);
     DO_TEST("disk-scsi-disk-vpd",
             QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN);
     DO_TEST_NOCAPS("disk-source-pool");
@@ -1002,12 +997,6 @@ mymain(void)
     DO_TEST("hostdev-scsi-shareable",
             QEMU_CAPS_VIRTIO_SCSI,
             QEMU_CAPS_SCSI_LSI);
-    DO_TEST("hostdev-scsi-sgio",
-            QEMU_CAPS_VIRTIO_SCSI,
-            QEMU_CAPS_SCSI_LSI);
-    DO_TEST("hostdev-scsi-rawio",
-            QEMU_CAPS_VIRTIO_SCSI,
-            QEMU_CAPS_SCSI_LSI);
 
     DO_TEST("hostdev-scsi-autogen-address",
             QEMU_CAPS_VIRTIO_SCSI,
-- 
2.31.1




More information about the libvir-list mailing list