[libvirt] [PATCH 17/21] qemu_hotplug: rename dev to match in qemuDomainDetachDeviceLive

Peter Krempa pkrempa at redhat.com
Fri Mar 22 11:50:48 UTC 2019


On Thu, Mar 21, 2019 at 18:28:57 -0400, Laine Stump wrote:
> I'm about to add a second virDomainDeviceDef to this function that
> will point to the actual device in the domain object. while this is
> just a partially filled-in example of what to look for. Naming it
> match will make the code easier to follow.
> 
> Signed-off-by: Laine Stump <laine at laine.org>
> ---
>  src/qemu/qemu_hotplug.c | 54 +++++++++++++++++++++++++----------------
>  src/qemu/qemu_hotplug.h |  2 +-
>  2 files changed, 34 insertions(+), 22 deletions(-)
> 
> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index 2d13fca871..903a0c46eb 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c
> @@ -6205,52 +6205,64 @@ qemuDomainDetachLease(virQEMUDriverPtr driver,
>  
>  int
>  qemuDomainDetachDeviceLive(virDomainObjPtr vm,
> -                           virDomainDeviceDefPtr dev,
> +                           virDomainDeviceDefPtr match,
>                             virQEMUDriverPtr driver,
>                             bool async)
>  {
>      int ret = -1;
>  
> -    switch ((virDomainDeviceType)dev->type) {
> +    switch ((virDomainDeviceType)match->type) {
> +        /*
> +         * lease and chr devices don't follow the standard pattern of
> +         * the others, so they must have their own self-contained
> +         * Detach functions.
> +         */
> +    case VIR_DOMAIN_DEVICE_LEASE:
> +        return qemuDomainDetachLease(driver, vm, match->data.lease);
> +
> +    case VIR_DOMAIN_DEVICE_CHR:
> +        return qemuDomainDetachChrDevice(driver, vm, match->data.chr, async);
> +
> +        /*
> +         * All the other device types follow a very similar pattern -
> +         * First we call type-specific functions to 1) locate the device
> +         * we want to detach (based on the prototype device in match)
> +         * and 2) do any device-type-specific validation to assure it
> +         * is okay to detach the device.
> +         */

This is again doing something not mentioned in the commit message.

-------------- 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/c0f63a93/attachment-0001.sig>


More information about the libvir-list mailing list