qemu: command: Simplify 'vnc' commandline generator

'qemuDomainSecretGraphicsPrepare' always populates 'gfxPriv->tlsAlias'
when 'cfg->vncTLS' is enabled.

This means we can remove the fallback code setting up TLS for vnc via
the 'x509=' parameter.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-09-23 10:09:20 +02:00
parent 33ebfe3756
commit 01c65d761c

View File

@ -7963,40 +7963,26 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfig *cfg,
if (cfg->vncTLS) {
qemuDomainGraphicsPrivate *gfxPriv = QEMU_DOMAIN_GRAPHICS_PRIVATE(graphics);
if (gfxPriv->tlsAlias) {
const char *secretAlias = NULL;
const char *secretAlias = NULL;
if (gfxPriv->secinfo) {
if (qemuBuildObjectSecretCommandLine(cmd,
gfxPriv->secinfo,
qemuCaps) < 0)
return -1;
secretAlias = gfxPriv->secinfo->alias;
}
if (qemuBuildTLSx509CommandLine(cmd,
cfg->vncTLSx509certdir,
true,
cfg->vncTLSx509verify,
secretAlias,
gfxPriv->tlsAlias,
qemuCaps) < 0)
if (gfxPriv->secinfo) {
if (qemuBuildObjectSecretCommandLine(cmd,
gfxPriv->secinfo,
qemuCaps) < 0)
return -1;
virBufferAsprintf(&opt, ",tls-creds=%s", gfxPriv->tlsAlias);
} else {
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC_OPTS))
virBufferAddLit(&opt, ",tls=on");
else
virBufferAddLit(&opt, ",tls");
if (cfg->vncTLSx509verify) {
virBufferAddLit(&opt, ",x509verify=");
virQEMUBuildBufferEscapeComma(&opt, cfg->vncTLSx509certdir);
} else {
virBufferAddLit(&opt, ",x509=");
virQEMUBuildBufferEscapeComma(&opt, cfg->vncTLSx509certdir);
}
secretAlias = gfxPriv->secinfo->alias;
}
if (qemuBuildTLSx509CommandLine(cmd,
cfg->vncTLSx509certdir,
true,
cfg->vncTLSx509verify,
secretAlias,
gfxPriv->tlsAlias,
qemuCaps) < 0)
return -1;
virBufferAsprintf(&opt, ",tls-creds=%s", gfxPriv->tlsAlias);
}
if (cfg->vncSASL) {