]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_domain_address.c: turn qemuDomainFillDeviceIsolationGroup to void
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Thu, 9 Jan 2020 18:33:48 +0000 (15:33 -0300)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 31 Jan 2020 14:25:33 +0000 (15:25 +0100)
Starting on commit 1f43393283ff, qemuDomainFillDeviceIsolationGroup()
returns 0 in all circunstances. Let's turn it to 'void' make it
clearer that the function will not fail. This also spares a
check for < 0 return in qemu_hotplug.c. The
qemuDomainFillDeviceIsolationGroupIter() callback now returns
0 at all times - which is already happening anyway.

Refer to 1f43393283ff commit message for more details on why
the function was changed to never return an error.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_domain_address.c
src/qemu/qemu_domain_address.h
src/qemu/qemu_hotplug.c

index b663e05391dfe2aa06f1892eb4a50e8b809c8a3e..409d850a06e4b6704dfef796bac5ed8f1800b61d 100644 (file)
@@ -1249,10 +1249,8 @@ qemuDomainFindUnusedIsolationGroup(virDomainDefPtr def)
  * @dev: device definition
  *
  * Fill isolation group information for a single device.
- *
- * Return: 0 on success, <0 on failure
- * */
-int
+ */
+void
 qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
                                    virDomainDeviceDefPtr dev)
 {
@@ -1270,7 +1268,7 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
         /* Only PCI host devices are subject to isolation */
         if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
             hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
-            return 0;
+            return;
         }
 
         hostAddr = &hostdev->source.subsys.u.pci.addr;
@@ -1278,7 +1276,7 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
         /* If a non-default isolation has already been assigned to the
          * device, we can avoid looking up the information again */
         if (info->isolationGroup > 0)
-            return 0;
+            return;
 
         /* The isolation group depends on the IOMMU group assigned by the host */
         tmp = virPCIDeviceAddressGetIOMMUGroupNum(hostAddr);
@@ -1288,7 +1286,7 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
                      "%04x:%02x:%02x.%x, device won't be isolated",
                      hostAddr->domain, hostAddr->bus,
                      hostAddr->slot, hostAddr->function);
-            return 0;
+            return;
         }
 
         /* The isolation group for a host device is its IOMMU group,
@@ -1314,13 +1312,13 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
          * require us to isolate the guest device, so we can skip them */
         if (iface->type != VIR_DOMAIN_NET_TYPE_NETWORK ||
             virDomainNetResolveActualType(iface) != VIR_DOMAIN_NET_TYPE_HOSTDEV) {
-            return 0;
+            return;
         }
 
         /* If a non-default isolation has already been assigned to the
          * device, we can avoid looking up the information again */
         if (info->isolationGroup > 0)
-            return 0;
+            return;
 
         /* Obtain a synthetic isolation group for the device, since at this
          * point in time we don't have access to the IOMMU group of the host
@@ -1332,7 +1330,7 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
                      "configured to use hostdev-backed network '%s', "
                      "device won't be isolated",
                      iface->data.network.name);
-            return 0;
+            return;
         }
 
         info->isolationGroup = tmp;
@@ -1341,8 +1339,6 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
                   "hostdev-backed network '%s' is %u",
                   iface->data.network.name, info->isolationGroup);
     }
-
-    return 0;
 }
 
 
@@ -1364,7 +1360,9 @@ qemuDomainFillDeviceIsolationGroupIter(virDomainDefPtr def,
                                        virDomainDeviceInfoPtr info G_GNUC_UNUSED,
                                        void *opaque G_GNUC_UNUSED)
 {
-    return qemuDomainFillDeviceIsolationGroup(def, dev);
+    qemuDomainFillDeviceIsolationGroup(def, dev);
+
+    return 0;
 }
 
 
index bf04e6bfdb0b86bc635a430719fbeb36a5d7b618..7ef330824655a03ed91f90f95221ea8c0a85e667 100644 (file)
@@ -49,7 +49,7 @@ int qemuDomainEnsurePCIAddress(virDomainObjPtr obj,
                                virQEMUDriverPtr driver)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
 
-int qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
+void qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
                                        virDomainDeviceDefPtr dev)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
index c23def7da721db092ca47088c2751d1e79e60dc6..39bcb70f83853b1eedd56363fea4d88b12d8298f 100644 (file)
@@ -1598,11 +1598,9 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
     if (qemuAssignDeviceHostdevAlias(vm->def, &info->alias, -1) < 0)
         goto error;
 
-    if (qemuDomainIsPSeries(vm->def)) {
+    if (qemuDomainIsPSeries(vm->def))
         /* Isolation groups are only relevant for pSeries guests */
-        if (qemuDomainFillDeviceIsolationGroup(vm->def, &dev) < 0)
-            goto error;
-    }
+        qemuDomainFillDeviceIsolationGroup(vm->def, &dev);
 
     if (qemuDomainEnsurePCIAddress(vm, &dev, driver) < 0)
         goto error;