qemu: Move qemuDomainSecretChardevPrepare call

Move the call to inside the qemuDomainAddChardevTLSObjects in order to
further converge the code.

Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2017-02-17 09:37:34 -05:00
parent 479b045b54
commit 26bef302c6

View File

@ -1647,10 +1647,12 @@ qemuDomainGetChardevTLSObjects(virQEMUDriverConfigPtr cfg,
static int static int
qemuDomainAddChardevTLSObjects(virQEMUDriverPtr driver, qemuDomainAddChardevTLSObjects(virConnectPtr conn,
virQEMUDriverPtr driver,
virQEMUDriverConfigPtr cfg, virQEMUDriverConfigPtr cfg,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainChrSourceDefPtr dev, virDomainChrSourceDefPtr dev,
char *devAlias,
char *charAlias, char *charAlias,
char **tlsAlias, char **tlsAlias,
char **secAlias) char **secAlias)
@ -1664,6 +1666,9 @@ qemuDomainAddChardevTLSObjects(virQEMUDriverPtr driver,
dev->data.tcp.haveTLS != VIR_TRISTATE_BOOL_YES) dev->data.tcp.haveTLS != VIR_TRISTATE_BOOL_YES)
return 0; return 0;
if (qemuDomainSecretChardevPrepare(conn, cfg, priv, devAlias, dev) < 0)
goto cleanup;
if (qemuDomainGetChardevTLSObjects(cfg, priv, dev, charAlias, if (qemuDomainGetChardevTLSObjects(cfg, priv, dev, charAlias,
&tlsProps, tlsAlias, &tlsProps, tlsAlias,
&secProps, secAlias) < 0) &secProps, secAlias) < 0)
@ -1720,12 +1725,9 @@ int qemuDomainAttachRedirdevDevice(virConnectPtr conn,
if (VIR_REALLOC_N(def->redirdevs, def->nredirdevs+1) < 0) if (VIR_REALLOC_N(def->redirdevs, def->nredirdevs+1) < 0)
goto cleanup; goto cleanup;
if (qemuDomainSecretChardevPrepare(conn, cfg, priv, redirdev->info.alias, if (qemuDomainAddChardevTLSObjects(conn, driver, cfg, vm, redirdev->source,
redirdev->source) < 0) redirdev->info.alias, charAlias,
goto cleanup; &tlsAlias, &secAlias) < 0)
if (qemuDomainAddChardevTLSObjects(driver, cfg, vm, redirdev->source,
charAlias, &tlsAlias, &secAlias) < 0)
goto audit; goto audit;
qemuDomainObjEnterMonitor(driver, vm); qemuDomainObjEnterMonitor(driver, vm);
@ -1981,11 +1983,8 @@ int qemuDomainAttachChrDevice(virConnectPtr conn,
if (qemuDomainChrPreInsert(vmdef, chr) < 0) if (qemuDomainChrPreInsert(vmdef, chr) < 0)
goto cleanup; goto cleanup;
if (qemuDomainSecretChardevPrepare(conn, cfg, priv, chr->info.alias, if (qemuDomainAddChardevTLSObjects(conn, driver, cfg, vm, dev,
dev) < 0) chr->info.alias, charAlias,
goto cleanup;
if (qemuDomainAddChardevTLSObjects(driver, cfg, vm, dev, charAlias,
&tlsAlias, &secAlias) < 0) &tlsAlias, &secAlias) < 0)
goto audit; goto audit;
@ -2123,12 +2122,10 @@ qemuDomainAttachRNGDevice(virConnectPtr conn,
goto cleanup; goto cleanup;
if (rng->backend == VIR_DOMAIN_RNG_BACKEND_EGD) { if (rng->backend == VIR_DOMAIN_RNG_BACKEND_EGD) {
if (qemuDomainSecretChardevPrepare(conn, cfg, priv, rng->info.alias, if (qemuDomainAddChardevTLSObjects(conn, driver, cfg, vm,
rng->source.chardev) < 0) rng->source.chardev,
goto cleanup; rng->info.alias, charAlias,
&tlsAlias, &secAlias) < 0)
if (qemuDomainAddChardevTLSObjects(driver, cfg, vm, rng->source.chardev,
charAlias, &tlsAlias, &secAlias) < 0)
goto audit; goto audit;
} }