[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 08/13] qemu: Move qemuDomainPrepareChardevSourceTLS call



On Fri, Feb 17, 2017 at 14:39:25 -0500, John Ferlan wrote:
> Move the call to inside the qemuDomainAddChardevTLSObjects in order to
> further converge the code.
> 
> Signed-off-by: John Ferlan <jferlan redhat com>
> ---
>  src/qemu/qemu_hotplug.c | 29 +++++++++++------------------
>  1 file changed, 11 insertions(+), 18 deletions(-)
> 
> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index 63ff1c6..c76a91e 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c
> @@ -1651,7 +1651,6 @@ qemuDomainGetChardevTLSObjects(virQEMUDriverConfigPtr cfg,
>  static int
>  qemuDomainAddChardevTLSObjects(virConnectPtr conn,
>                                 virQEMUDriverPtr driver,
> -                               virQEMUDriverConfigPtr cfg,
>                                 virDomainObjPtr vm,
>                                 virDomainChrSourceDefPtr dev,
>                                 char *devAlias,
> @@ -1660,13 +1659,19 @@ qemuDomainAddChardevTLSObjects(virConnectPtr conn,
>                                 char **secAlias)
>  {
>      int ret = -1;
> +    virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
>      qemuDomainObjPrivatePtr priv = vm->privateData;
>      virJSONValuePtr tlsProps = NULL;
>      virJSONValuePtr secProps = NULL;
>  
> +    /* NB: This may alter haveTLS based on cfg */
> +    qemuDomainPrepareChardevSourceTLS(dev, cfg);
> +
>      if (dev->type != VIR_DOMAIN_CHR_TYPE_TCP ||
> -        dev->data.tcp.haveTLS != VIR_TRISTATE_BOOL_YES)
> +        dev->data.tcp.haveTLS != VIR_TRISTATE_BOOL_YES) {
> +        virObjectUnref(cfg);

I think
           ret = 0;
           goto cleanup;

would be better here.

>          return 0;
> +    }

Looks good otherwise.

Jirka


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]