提交 715b321d 编写于 作者: J John Ferlan

qemu: Move TCP and haveTLS checks into qemuDomainDelChardevTLSObjects

Similar to qemuDomainAddChardevTLSObjects let's move the chardev
source must be TCP and it has the @haveTLS flag set checks before
trying to delete the TLS objects.

For the Chr device this represents no change; however, for RNG device
this is an additionaly check that was missed in commit id '68808516'.
Before adding the objects, TCP and haveTLS are checked.
上级 10dcdfa3
......@@ -1565,6 +1565,7 @@ qemuDomainAddChardevTLSObjects(virConnectPtr conn,
static int
qemuDomainDelChardevTLSObjects(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainChrSourceDefPtr dev,
const char *inAlias)
{
int ret = -1;
......@@ -1573,6 +1574,12 @@ qemuDomainDelChardevTLSObjects(virQEMUDriverPtr driver,
char *tlsAlias = NULL;
char *secAlias = NULL;
if (dev->type != VIR_DOMAIN_CHR_TYPE_TCP ||
dev->data.tcp.haveTLS != VIR_TRISTATE_BOOL_YES) {
ret = 0;
goto cleanup;
}
if (!(tlsAlias = qemuAliasTLSObjFromSrcAlias(inAlias)))
goto cleanup;
......@@ -4178,10 +4185,8 @@ qemuDomainRemoveChrDevice(virQEMUDriverPtr driver,
if (qemuDomainObjExitMonitor(driver, vm) < 0)
goto cleanup;
if (chr->source->type == VIR_DOMAIN_CHR_TYPE_TCP &&
chr->source->data.tcp.haveTLS == VIR_TRISTATE_BOOL_YES &&
rc == 0 &&
qemuDomainDelChardevTLSObjects(driver, vm, charAlias) < 0)
if (rc == 0 &&
qemuDomainDelChardevTLSObjects(driver, vm, chr->source, charAlias) < 0)
goto cleanup;
virDomainAuditChardev(vm, chr, NULL, "detach", rc == 0);
......@@ -4243,7 +4248,8 @@ qemuDomainRemoveRNGDevice(virQEMUDriverPtr driver,
if (rng->backend == VIR_DOMAIN_RNG_BACKEND_EGD &&
rc == 0 &&
qemuDomainDelChardevTLSObjects(driver, vm, charAlias) < 0)
qemuDomainDelChardevTLSObjects(driver, vm, rng->source.chardev,
charAlias) < 0)
goto cleanup;
virDomainAuditRNG(vm, rng, NULL, "detach", rc == 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册