[libvirt] [PATCH 1/4] qemu: Introduce qemuDomainGetChardevTLSObjects for hotplug
Pavel Hrdina
phrdina at redhat.com
Mon Oct 24 07:04:46 UTC 2016
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 at redhat.com>
> ---
> 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 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: 801 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20161024/a3c8d4a8/attachment-0001.sig>
More information about the libvir-list
mailing list