From: Peter Krempa Date: Mon, 17 Mar 2025 16:50:42 +0000 (+0100) Subject: qemu: Remove return value from 'qemuHotplugRemoveManagedPR' X-Git-Tag: v11.2.0-rc1~90 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f00a208eaa9b971af2a7db5367c95bfa217e851;p=thirdparty%2Flibvirt.git qemu: Remove return value from 'qemuHotplugRemoveManagedPR' 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 Reviewed-by: Pavel Hrdina --- diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 7b7d54fdca..c1b29f2fde 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -709,7 +709,7 @@ qemuBlockJobEventProcessConcludedRemoveChain(virQEMUDriver *driver, qemuDomainStorageSourceChainAccessRevoke(driver, vm, chain); - ignore_value(qemuHotplugRemoveManagedPR(vm, asyncJob)); + qemuHotplugRemoveManagedPR(vm, asyncJob); } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 69f18d88d6..fb6d4e9bff 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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")); diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index fdd40cfe15..db15a7262a 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -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); diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h index 7c858fc73e..63ed7bbafd 100644 --- a/src/qemu/qemu_hotplug.h +++ b/src/qemu/qemu_hotplug.h @@ -131,6 +131,6 @@ int qemuHotplugAttachManagedPR(virDomainObj *vm, virStorageSource *src, virDomainAsyncJob asyncJob); -int +void qemuHotplugRemoveManagedPR(virDomainObj *vm, virDomainAsyncJob asyncJob);