[libvirt] [PATCH v5 10/11] qemu_hotplug: Hotunplug of reservations

John Ferlan jferlan at redhat.com
Sun Apr 29 17:10:52 UTC 2018



On 04/23/2018 09:14 AM, Michal Privoznik wrote:
> If we are the last one to use pr-manager object we need to remove
> it and also kill the qemu-pr-helper process.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/qemu/qemu_hotplug.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 56 insertions(+)
> 
> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index 2e736873d1..e9dd8a4532 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c
> @@ -3824,6 +3824,49 @@ static bool qemuIsMultiFunctionDevice(virDomainDefPtr def,
>  }
>  
>  
> +static int
> +qemuDomainDiskNeedRemovePR(virDomainObjPtr vm,
> +                           virDomainDiskDefPtr disk,
> +                           char **aliasret,
> +                           bool *stopDaemon)
> +{
> +    qemuDomainObjPrivatePtr priv = vm->privateData;
> +    size_t i;
> +
> +    *aliasret = NULL;
> +    *stopDaemon = false;
> +
> +    if (!virStoragePRDefIsEnabled(disk->src->pr))
> +        return 0;
> +
> +    if (!virStoragePRDefIsManaged(disk->src->pr)) {
> +        *aliasret = qemuDomainGetUnmanagedPRAlias(disk);
> +        return *aliasret ? 0 : -1;
> +    }
> +
> +    for (i = 0; i < vm->def->ndisks; i++) {
> +        const virDomainDiskDef *domainDisk = vm->def->disks[i];
> +
> +        if (domainDisk == disk)
> +            continue;
> +
> +        if (virStoragePRDefIsManaged(domainDisk->src->pr))
> +            break;
> +    }
> +
> +    if (i != vm->def->ndisks)
> +        return 0;
> +
> +    if (VIR_STRDUP(*aliasret, qemuDomainGetManagedPRAlias()) < 0)

and again here a simple:

if (VIR_STRDUP(*aliasret, QEMU_DOMAIN_MANAGED_PR_ALIAS) < 0)

would suffice


Reviewed-by: John Ferlan <jferlan at redhat.com>

John

/me waits for the tester that starts/stops 100's of times in a row ;-)

[...]




More information about the libvir-list mailing list