]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Remove return value from 'qemuHotplugRemoveManagedPR'
authorPeter Krempa <pkrempa@redhat.com>
Mon, 17 Mar 2025 16:50:42 +0000 (17:50 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 20 Mar 2025 05:42:43 +0000 (06:42 +0100)
The only place which actually checked the return value would skip code
e.g. to delete unused files or stop no longer used services. The rest of
the callers ignored the value.

As this is expected to be used on cleanup code paths which have no
possibility to report errors we should remove the return value
completely.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/qemu/qemu_blockjob.c
src/qemu/qemu_driver.c
src/qemu/qemu_hotplug.c
src/qemu/qemu_hotplug.h

index 7b7d54fdcaf8a0a2e9605b364bb9441090257551..c1b29f2fde8d1cb2b96a3a3595477b3b1db4a602 100644 (file)
@@ -709,7 +709,7 @@ qemuBlockJobEventProcessConcludedRemoveChain(virQEMUDriver *driver,
 
     qemuDomainStorageSourceChainAccessRevoke(driver, vm, chain);
 
-    ignore_value(qemuHotplugRemoveManagedPR(vm, asyncJob));
+    qemuHotplugRemoveManagedPR(vm, asyncJob);
 }
 
 
index 69f18d88d63ea7ef1343a971a9157a1a255bc4c3..fb6d4e9bff3f5d582fd20c910a5476ba2c6d04a2 100644 (file)
@@ -14416,7 +14416,7 @@ qemuDomainBlockCopyCommon(virDomainObj *vm,
         if (need_revoke)
             qemuDomainStorageSourceChainAccessRevoke(driver, vm, mirror);
 
-        ignore_value(qemuHotplugRemoveManagedPR(vm, VIR_ASYNC_JOB_NONE));
+        qemuHotplugRemoveManagedPR(vm, VIR_ASYNC_JOB_NONE);
     }
     if (need_unlink && virStorageSourceUnlink(mirror) < 0)
         VIR_WARN("%s", _("unable to remove just-created copy target"));
index fdd40cfe159ba8bd1b254d88211600bd89c97cc7..db15a7262a878aab2e3f603099e31f5d566825ce 100644 (file)
@@ -469,31 +469,29 @@ qemuHotplugAttachManagedPR(virDomainObj *vm,
  * Removes the managed PR object from @vm if the configuration does not require
  * it any more.
  */
-int
+void
 qemuHotplugRemoveManagedPR(virDomainObj *vm,
                            virDomainAsyncJob asyncJob)
 {
     qemuDomainObjPrivate *priv = vm->privateData;
     virErrorPtr orig_err;
-    int ret = -1;
 
     if (qemuDomainDefHasManagedPR(vm))
-        return 0;
+        return;
 
     virErrorPreserveLast(&orig_err);
 
     if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0)
         goto cleanup;
+
     ignore_value(qemuMonitorDelObject(priv->mon, qemuDomainGetManagedPRAlias(),
                                       false));
     qemuDomainObjExitMonitor(vm);
 
     qemuProcessKillManagedPRDaemon(vm);
 
-    ret = 0;
  cleanup:
     virErrorRestore(&orig_err);
-    return ret;
 }
 
 
@@ -665,7 +663,7 @@ qemuDomainChangeEjectableMedia(virQEMUDriver *driver,
 
     /* remove PR manager object if unneeded */
     if (managedpr)
-        ignore_value(qemuHotplugRemoveManagedPR(vm, VIR_ASYNC_JOB_NONE));
+        qemuHotplugRemoveManagedPR(vm, VIR_ASYNC_JOB_NONE);
 
     /* revert old image do the disk definition */
     if (oldsrc)
@@ -1099,7 +1097,7 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver *driver,
             ignore_value(qemuDomainStorageSourceChainAccessRevoke(driver, vm, disk->src));
 
         if (virStorageSourceChainHasManagedPR(disk->src))
-            ignore_value(qemuHotplugRemoveManagedPR(vm, VIR_ASYNC_JOB_NONE));
+            qemuHotplugRemoveManagedPR(vm, VIR_ASYNC_JOB_NONE);
     }
     qemuDomainSecretDiskDestroy(disk);
     qemuDomainCleanupStorageSourceFD(disk->src);
@@ -4788,9 +4786,8 @@ qemuDomainRemoveDiskDevice(virQEMUDriver *driver,
     if (diskBackend)
         qemuDomainStorageSourceChainAccessRevoke(driver, vm, disk->src);
 
-    if (virStorageSourceChainHasManagedPR(disk->src) &&
-        qemuHotplugRemoveManagedPR(vm, VIR_ASYNC_JOB_NONE) < 0)
-        goto cleanup;
+    if (virStorageSourceChainHasManagedPR(disk->src))
+        qemuHotplugRemoveManagedPR(vm, VIR_ASYNC_JOB_NONE);
 
     qemuNbdkitStopStorageSource(disk->src, vm, true);
 
index 7c858fc73e403a02074d99c9ed83c65994b4d61e..63ed7bbafdd198576bad94c24e792e1adf896025 100644 (file)
@@ -131,6 +131,6 @@ int
 qemuHotplugAttachManagedPR(virDomainObj *vm,
                            virStorageSource *src,
                            virDomainAsyncJob asyncJob);
-int
+void
 qemuHotplugRemoveManagedPR(virDomainObj *vm,
                            virDomainAsyncJob asyncJob);