Re: [PATCH 1/4] qemu: Introduce qemuDomainGetChardevTLSObjects for hotplug

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

 



On Fri, Oct 21, 2016 at 10:22:28AM -0400, John Ferlan wrote:
> As it turns out more than one place will need these objects, so rather
> than cut-copy-paste in each, make a helper
> 
> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  src/qemu/qemu_hotplug.c | 41 +++++++++++++++++++++++++++++------------
>  1 file changed, 29 insertions(+), 12 deletions(-)
> 
> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index 2cb2267..8a7c7cb 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c
> @@ -1474,6 +1474,32 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
>  }
>  
>  
> +static int
> +qemuDomainGetChardevTLSObjects(virQEMUDriverConfigPtr cfg,
> +                               qemuDomainObjPrivatePtr priv,
> +                               virDomainChrSourceDefPtr dev,
> +                               char *charAlias,
> +                               virJSONValuePtr *tlsProps,
> +                               char **tlsAlias)
> +{
> +    if (!cfg->chardevTLS)
> +        return 0;
> +
> +    if (qemuBuildTLSx509BackendProps(cfg->chardevTLSx509certdir,
> +                                     dev->data.tcp.listen,
> +                                     cfg->chardevTLSx509verify,
> +                                     priv->qemuCaps,
> +                                     tlsProps) < 0)
> +        return -1;
> +
> +    if (!(*tlsAlias = qemuAliasTLSObjFromChardevAlias(charAlias)))
> +        return -1;
> +    dev->data.tcp.tlscreds = true;
> +
> +    return 0;
> +}
> +
> +
>  int qemuDomainAttachRedirdevDevice(virQEMUDriverPtr driver,
>                                     virDomainObjPtr vm,
>                                     virDomainRedirdevDefPtr redirdev)
> @@ -1730,18 +1756,9 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr driver,
>          goto cleanup;
>  
>      if (dev->type == VIR_DOMAIN_CHR_TYPE_TCP &&

I would move this check to the helper as well, see comments for patch 04.

ACK with that fixed.

Pavel

> -        cfg->chardevTLS) {
> -        if (qemuBuildTLSx509BackendProps(cfg->chardevTLSx509certdir,
> -                                         dev->data.tcp.listen,
> -                                         cfg->chardevTLSx509verify,
> -                                         priv->qemuCaps,
> -                                         &tlsProps) < 0)
> -            goto cleanup;
> -
> -        if (!(tlsAlias = qemuAliasTLSObjFromChardevAlias(charAlias)))
> -            goto cleanup;
> -        dev->data.tcp.tlscreds = true;
> -    }
> +        qemuDomainGetChardevTLSObjects(cfg, priv, dev, charAlias,
> +                                       &tlsProps, &tlsAlias) < 0)
> +        goto cleanup;
>  
>      qemuDomainObjEnterMonitor(driver, vm);
>      if (tlsAlias) {
> -- 
> 2.7.4
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]