mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 09:55:18 +00:00
qemu: command: Pass in alias for TLS object to qemuBuildTLSx509CommandLine
Callers need to know the alias anyways so it does not make much sense to generate it inside of this function. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
8a5cd05b55
commit
867fb534a7
@ -725,7 +725,7 @@ qemuBuildTLSx509BackendProps(const char *tlspath,
|
|||||||
* @verifypeer: boolean to enable peer verification (form of authorization)
|
* @verifypeer: boolean to enable peer verification (form of authorization)
|
||||||
* @certEncSecretAlias: alias of a 'secret' object for decrypting TLS private key
|
* @certEncSecretAlias: alias of a 'secret' object for decrypting TLS private key
|
||||||
* (optional)
|
* (optional)
|
||||||
* @inalias: Alias for the parent to generate object alias
|
* @alias: TLS object alias
|
||||||
* @qemuCaps: capabilities
|
* @qemuCaps: capabilities
|
||||||
*
|
*
|
||||||
* Create the command line for a TLS object
|
* Create the command line for a TLS object
|
||||||
@ -738,11 +738,10 @@ qemuBuildTLSx509CommandLine(virCommandPtr cmd,
|
|||||||
bool isListen,
|
bool isListen,
|
||||||
bool verifypeer,
|
bool verifypeer,
|
||||||
const char *certEncSecretAlias,
|
const char *certEncSecretAlias,
|
||||||
const char *inalias,
|
const char *alias,
|
||||||
virQEMUCapsPtr qemuCaps)
|
virQEMUCapsPtr qemuCaps)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
char *objalias = NULL;
|
|
||||||
virJSONValuePtr props = NULL;
|
virJSONValuePtr props = NULL;
|
||||||
char *tmp = NULL;
|
char *tmp = NULL;
|
||||||
|
|
||||||
@ -751,11 +750,8 @@ qemuBuildTLSx509CommandLine(virCommandPtr cmd,
|
|||||||
qemuCaps, &props) < 0)
|
qemuCaps, &props) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(objalias = qemuAliasTLSObjFromSrcAlias(inalias)))
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (!(tmp = virQEMUBuildObjectCommandlineFromJSON("tls-creds-x509",
|
if (!(tmp = virQEMUBuildObjectCommandlineFromJSON("tls-creds-x509",
|
||||||
objalias, props)))
|
alias, props)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
virCommandAddArgList(cmd, "-object", tmp, NULL);
|
virCommandAddArgList(cmd, "-object", tmp, NULL);
|
||||||
@ -764,7 +760,6 @@ qemuBuildTLSx509CommandLine(virCommandPtr cmd,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virJSONValueFree(props);
|
virJSONValueFree(props);
|
||||||
VIR_FREE(objalias);
|
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -779,7 +774,6 @@ qemuBuildTLSx509CommandLine(virCommandPtr cmd,
|
|||||||
static int
|
static int
|
||||||
qemuBuildDiskSrcTLSx509CommandLine(virCommandPtr cmd,
|
qemuBuildDiskSrcTLSx509CommandLine(virCommandPtr cmd,
|
||||||
virStorageSourcePtr src,
|
virStorageSourcePtr src,
|
||||||
const char *srcalias,
|
|
||||||
virQEMUCapsPtr qemuCaps)
|
virQEMUCapsPtr qemuCaps)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -789,7 +783,7 @@ qemuBuildDiskSrcTLSx509CommandLine(virCommandPtr cmd,
|
|||||||
src->haveTLS == VIR_TRISTATE_BOOL_YES) {
|
src->haveTLS == VIR_TRISTATE_BOOL_YES) {
|
||||||
return qemuBuildTLSx509CommandLine(cmd, src->tlsCertdir,
|
return qemuBuildTLSx509CommandLine(cmd, src->tlsCertdir,
|
||||||
false, src->tlsVerify,
|
false, src->tlsVerify,
|
||||||
NULL, srcalias, qemuCaps);
|
NULL, src->tlsAlias, qemuCaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -2291,8 +2285,7 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
|
|||||||
if (qemuBuildDiskSecinfoCommandLine(cmd, encinfo) < 0)
|
if (qemuBuildDiskSecinfoCommandLine(cmd, encinfo) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (qemuBuildDiskSrcTLSx509CommandLine(cmd, disk->src, disk->info.alias,
|
if (qemuBuildDiskSrcTLSx509CommandLine(cmd, disk->src, qemuCaps) < 0)
|
||||||
qemuCaps) < 0)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
virCommandAddArg(cmd, "-drive");
|
virCommandAddArg(cmd, "-drive");
|
||||||
@ -4996,15 +4989,18 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager,
|
|||||||
tlsCertEncSecAlias = chrSourcePriv->secinfo->s.aes.alias;
|
tlsCertEncSecAlias = chrSourcePriv->secinfo->s.aes.alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(objalias = qemuAliasTLSObjFromSrcAlias(charAlias)))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (qemuBuildTLSx509CommandLine(cmd, cfg->chardevTLSx509certdir,
|
if (qemuBuildTLSx509CommandLine(cmd, cfg->chardevTLSx509certdir,
|
||||||
dev->data.tcp.listen,
|
dev->data.tcp.listen,
|
||||||
cfg->chardevTLSx509verify,
|
cfg->chardevTLSx509verify,
|
||||||
tlsCertEncSecAlias,
|
tlsCertEncSecAlias,
|
||||||
charAlias, qemuCaps) < 0)
|
objalias, qemuCaps) < 0) {
|
||||||
|
VIR_FREE(objalias);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(objalias = qemuAliasTLSObjFromSrcAlias(charAlias)))
|
|
||||||
goto cleanup;
|
|
||||||
virBufferAsprintf(&buf, ",tls-creds=%s", objalias);
|
virBufferAsprintf(&buf, ",tls-creds=%s", objalias);
|
||||||
VIR_FREE(objalias);
|
VIR_FREE(objalias);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user