[libvirt] [PATCH 2/7] qemuDomainValidateStorageSource: Relax PR validation

Peter Krempa pkrempa at redhat.com
Wed Jul 4 12:01:53 UTC 2018


On Wed, Jul 04, 2018 at 12:46:50 +0200, Michal Privoznik wrote:
> Actually, it is not always bug if path is provided. For instance,
> on domain migration the migration XML contains the path even for
> managed reservations. Accept this and teach our prepare code to
> not leak in this case.

Please reformulate this so that is clear that rather than rejecting the
user provided path and alias (which is not mentioned above) for the
managed PR reservation we will ignore the (user) provided path rather
than reject it.

Also isn't the alias part of the private data and thus not transferred
during migration? It certainly should not be formatted for the
migratable case.

> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/qemu/qemu_domain.c | 21 ++++++++-------------
>  1 file changed, 8 insertions(+), 13 deletions(-)
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index a60bca29ca..706ee9be46 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -4615,19 +4615,11 @@ qemuDomainValidateStorageSource(virStorageSourcePtr src,
>          }
>      }
>  
> -    if (src->pr) {
> -        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PR_MANAGER_HELPER)) {
> -            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> -                           _("reservations not supported with this QEMU binary"));
> -            return -1;
> -        }
> -
> -        if (virStoragePRDefIsManaged(src->pr) && src->pr->path) {
> -            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> -                           _("'path' attribute should not be provided for "
> -                             "managed reservations"));
> -            return -1;
> -        }
> +    if (src->pr &&
> +        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_PR_MANAGER_HELPER)) {
> +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                       _("reservations not supported with this QEMU binary"));
> +        return -1;
>      }
>  
>      return 0;
> @@ -12852,7 +12844,10 @@ qemuDomainPrepareStorageSourcePR(virStorageSourcePtr src,
>      if (!src->pr)
>          return 0;
>  
> +    VIR_FREE(src->pr->mgralias);
> +
>      if (virStoragePRDefIsManaged(src->pr)) {
> +        VIR_FREE(src->pr->path);
>          if (!(src->pr->path = qemuDomainGetManagedPRSocketPath(priv)))
>              return -1;
>          if (VIR_STRDUP(src->pr->mgralias, qemuDomainGetManagedPRAlias()) < 0)
> -- 
> 2.16.4
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- 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/20180704/fc7bc33b/attachment-0001.sig>


More information about the libvir-list mailing list