[libvirt] [PATCH 14/21] qemu_hotplug: remove extra function in middle of DetachController call chain

Peter Krempa pkrempa at redhat.com
Fri Mar 22 11:39:30 UTC 2019


On Thu, Mar 21, 2019 at 18:28:54 -0400, Laine Stump wrote:
> qemuDomainDetachDeviceControllerLive() just checks if the controller
> type is SCSI, and then either returns failure, or calls
> qemuDomainDetachControllerDevice().
> 
> Instead, lets just check for type != SCSI at the top of the latter
> function, and call it directly.
> 
> Signed-off-by: Laine Stump <laine at laine.org>
> ---
>  src/qemu/qemu_hotplug.c | 42 ++++++++++++++---------------------------
>  1 file changed, 14 insertions(+), 28 deletions(-)
> 
> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index c7aba74c6b..6b713e1c27 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c

[...]

> @@ -5561,6 +5568,12 @@ qemuDomainDetachControllerDevice(virQEMUDriverPtr driver,
>  
>      detach = vm->def->controllers[idx];
>  
> +    if (qemuDomainControllerIsBusy(vm, detach)) {
> +        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
> +                       _("device cannot be detached: device is busy"));
> +        goto cleanup;
> +    }
> +
>      if (qemuIsMultiFunctionDevice(vm->def, &detach->info)) {
>          virReportError(VIR_ERR_OPERATION_FAILED,
>                         _("cannot hot unplug multifunction PCI device: %s"),
> @@ -5568,12 +5581,6 @@ qemuDomainDetachControllerDevice(virQEMUDriverPtr driver,
>          goto cleanup;
>      }
>  
> -    if (qemuDomainControllerIsBusy(vm, detach)) {
> -        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
> -                       _("device cannot be detached: device is busy"));
> -        goto cleanup;
> -    }
> -

This change is not mentioned in the commit message. Also it's not really
functionally important.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190322/50615785/attachment-0001.sig>


More information about the libvir-list mailing list