[libvirt PATCH 3/7] qemu: remove all use of SGIO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Now that the 'unfiltered' attribute is rejected by the validator,
remove all the code that deals with the feature.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/libvirt_private.syms |   2 -
 src/qemu/qemu_conf.c     | 121 ---------------------------------------
 src/qemu/qemu_conf.h     |   2 -
 src/qemu/qemu_hostdev.c  |   3 -
 src/qemu/qemu_hotplug.c  |   3 -
 src/qemu/qemu_process.c  |   3 -
 6 files changed, 134 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 932dbf4f72..48e8ef6c72 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3511,7 +3511,6 @@ virDoubleToStr;
 virFormatIntDecimal;
 virFormatIntPretty;
 virGetDeviceID;
-virGetDeviceUnprivSGIO;
 virGetGroupID;
 virGetGroupList;
 virGetGroupName;
@@ -3545,7 +3544,6 @@ virPipeQuiet;
 virScaleInteger;
 virSetBlocking;
 virSetCloseExec;
-virSetDeviceUnprivSGIO;
 virSetInherit;
 virSetNonBlock;
 virSetSockReuseAddr;
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 73497ad848..28cbdd6e61 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1472,65 +1472,6 @@ qemuGetSharedDeviceKey(const char *device_path)
     return g_strdup_printf("%d:%d", maj, min);
 }
 
-/*
- * Make necessary checks for the need to check and for the current setting
- * of the 'unpriv_sgio' value for the device_path passed.
- *
- * Returns:
- *  0 - Success
- * -1 - Some failure which would already have been messaged
- * -2 - Mismatch with the "shared" sgio setting - needs to be messaged
- *      by caller since it has context of which type of disk resource is
- *      being used and in the future the hostdev information.
- */
-static int
-qemuCheckUnprivSGIO(GHashTable *sharedDevices G_GNUC_UNUSED,
-                    const char *device_path G_GNUC_UNUSED,
-                    int sgio G_GNUC_UNUSED)
-{
-    /* It can't be conflict if unpriv_sgio is not supported by kernel. */
-    return 0;
-}
-
-
-/* Check if a shared device's setting conflicts with the conf
- * used by other domain(s). Currently only checks the sgio
- * setting. Note that this should only be called for disk with
- * block source if the device type is disk.
- *
- * Returns 0 if no conflicts, otherwise returns -1.
- */
-static int
-qemuCheckSharedDisk(GHashTable *sharedDevices,
-                    virDomainDiskDef *disk)
-{
-    int ret;
-
-    if (disk->device != VIR_DOMAIN_DISK_DEVICE_LUN)
-        return 0;
-
-    if ((ret = qemuCheckUnprivSGIO(sharedDevices, disk->src->path,
-                                   disk->sgio)) < 0) {
-        if (ret == -2) {
-            if (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_VOLUME) {
-                virReportError(VIR_ERR_OPERATION_INVALID,
-                               _("sgio of shared disk 'pool=%s' 'volume=%s' "
-                                 "conflicts with other active domains"),
-                               disk->src->srcpool->pool,
-                               disk->src->srcpool->volume);
-            } else {
-                virReportError(VIR_ERR_OPERATION_INVALID,
-                               _("sgio of shared disk '%s' conflicts with "
-                                 "other active domains"),
-                               disk->src->path);
-            }
-        }
-        return -1;
-    }
-
-    return 0;
-}
-
 
 bool
 qemuSharedDeviceEntryDomainExists(qemuSharedDeviceEntry *entry,
@@ -1647,9 +1588,6 @@ qemuSharedDiskAddRemoveInternal(virQEMUDriver *driver,
         goto cleanup;
 
     if (addDisk) {
-        if (qemuCheckSharedDisk(driver->sharedDevices, disk) < 0)
-            goto cleanup;
-
         if (qemuSharedDeviceEntryInsert(driver, key, name) < 0)
             goto cleanup;
     } else {
@@ -1804,65 +1742,6 @@ qemuRemoveSharedDevice(virQEMUDriver *driver,
 }
 
 
-int
-qemuSetUnprivSGIO(virDomainDeviceDef *dev)
-{
-    virDomainDiskDef *disk = NULL;
-    virDomainHostdevDef *hostdev = NULL;
-    const char *path = NULL;
-    int val = -1;
-
-    /* "sgio" is only valid for block disk; cdrom
-     * and floopy disk can have empty source.
-     */
-    if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
-        disk = dev->data.disk;
-
-        if (disk->device != VIR_DOMAIN_DISK_DEVICE_LUN ||
-            !virStorageSourceIsBlockLocal(disk->src))
-            return 0;
-
-        path = virDomainDiskGetSource(disk);
-    } else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
-        hostdev = dev->data.hostdev;
-
-        if (!qemuIsSharedHostdev(hostdev))
-            return 0;
-
-        if (hostdev->source.subsys.u.scsi.sgio) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("'sgio' is not supported for SCSI "
-                             "generic device yet "));
-            return -1;
-        }
-
-        return 0;
-    } else {
-        return 0;
-    }
-
-    /* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0.  */
-    val = (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED);
-
-    /* Do not do anything if unpriv_sgio is not supported by the kernel and the
-     * whitelist is enabled.  But if requesting unfiltered access, always call
-     * virSetDeviceUnprivSGIO, to report an error for unsupported unpriv_sgio.
-     */
-    if (val == 1) {
-        int curr_val;
-
-        if (virGetDeviceUnprivSGIO(path, NULL, &curr_val) < 0)
-            return -1;
-
-        if (curr_val != val &&
-            virSetDeviceUnprivSGIO(path, NULL, val) < 0) {
-            return -1;
-        }
-    }
-
-    return 0;
-}
-
 int qemuDriverAllocateID(virQEMUDriver *driver)
 {
     return g_atomic_int_add(&driver->lastvmid, 1) + 1;
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 2f64e39a18..5961b0b205 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -376,8 +376,6 @@ int qemuRemoveSharedDisk(virQEMUDriver *driver,
                          const char *name)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
 
-int qemuSetUnprivSGIO(virDomainDeviceDef *dev);
-
 int qemuDriverAllocateID(virQEMUDriver *driver);
 virDomainXMLOption *virQEMUDriverCreateXMLConf(virQEMUDriver *driver,
                                                  const char *defsecmodel);
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index 00f301f941..5461de459a 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -289,9 +289,6 @@ qemuHostdevPrepareSCSIDevices(virQEMUDriver *driver,
 
         if (qemuAddSharedDevice(driver, &dev, name) < 0)
             return -1;
-
-        if (qemuSetUnprivSGIO(&dev) < 0)
-            return -1;
     }
 
     return virHostdevPrepareSCSIDevices(hostdev_mgr, QEMU_DRIVER_NAME,
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 04c6600f26..0dd3121221 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -980,9 +980,6 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver *driver,
     if (qemuAddSharedDevice(driver, dev, vm->def->name) < 0)
         goto cleanup;
 
-    if (qemuSetUnprivSGIO(dev) < 0)
-        goto cleanup;
-
     if (qemuDomainDetermineDiskChain(driver, vm, disk, NULL, true) < 0)
         goto cleanup;
 
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 5c9ca0fe4f..b425acfec1 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5046,9 +5046,6 @@ qemuProcessSetupRawIO(virQEMUDriver *driver,
         dev.data.disk = disk;
         if (qemuAddSharedDevice(driver, &dev, vm->def->name) < 0)
             goto cleanup;
-
-        if (qemuSetUnprivSGIO(&dev) < 0)
-            goto cleanup;
     }
 
     /* If rawio not already set, check hostdevs as well */
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux