mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 15:52:55 +00:00
qemu: Introduce qemuDomainGetChardevTLSObjects for hotplug
As it turns out more than one place will need these objects, so rather than cut-copy-paste in each, make a helper
This commit is contained in:
parent
526acb6a7f
commit
8b82355e51
@ -1474,6 +1474,32 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
qemuDomainGetChardevTLSObjects(virQEMUDriverConfigPtr cfg,
|
||||||
|
qemuDomainObjPrivatePtr priv,
|
||||||
|
virDomainChrSourceDefPtr dev,
|
||||||
|
char *charAlias,
|
||||||
|
virJSONValuePtr *tlsProps,
|
||||||
|
char **tlsAlias)
|
||||||
|
{
|
||||||
|
if (dev->type != VIR_DOMAIN_CHR_TYPE_TCP || !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,
|
int qemuDomainAttachRedirdevDevice(virQEMUDriverPtr driver,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
virDomainRedirdevDefPtr redirdev)
|
virDomainRedirdevDefPtr redirdev)
|
||||||
@ -1730,19 +1756,9 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr driver,
|
|||||||
if (qemuDomainChrPreInsert(vmdef, chr) < 0)
|
if (qemuDomainChrPreInsert(vmdef, chr) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (dev->type == VIR_DOMAIN_CHR_TYPE_TCP &&
|
if (qemuDomainGetChardevTLSObjects(cfg, priv, dev, charAlias,
|
||||||
cfg->chardevTLS) {
|
&tlsProps, &tlsAlias) < 0)
|
||||||
if (qemuBuildTLSx509BackendProps(cfg->chardevTLSx509certdir,
|
goto cleanup;
|
||||||
dev->data.tcp.listen,
|
|
||||||
cfg->chardevTLSx509verify,
|
|
||||||
priv->qemuCaps,
|
|
||||||
&tlsProps) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (!(tlsAlias = qemuAliasTLSObjFromChardevAlias(charAlias)))
|
|
||||||
goto cleanup;
|
|
||||||
dev->data.tcp.tlscreds = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
qemuDomainObjEnterMonitor(driver, vm);
|
qemuDomainObjEnterMonitor(driver, vm);
|
||||||
if (tlsAlias) {
|
if (tlsAlias) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user