mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemuBuildTPMProxyCommandLine: Generate via JSON
All properties are strings according to QEMU. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
304ffa2dff
commit
5e24a5021c
@ -9980,19 +9980,20 @@ qemuBuildTPMCommandLine(virCommand *cmd,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
qemuBuildTPMProxyCommandLine(virCommand *cmd,
|
qemuBuildTPMProxyCommandLine(virCommand *cmd,
|
||||||
virDomainTPMDef *tpm)
|
virDomainTPMDef *tpm,
|
||||||
|
virQEMUCaps *qemuCaps)
|
||||||
{
|
{
|
||||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
g_autoptr(virJSONValue) props = NULL;
|
||||||
const char *filePath = NULL;
|
|
||||||
|
|
||||||
filePath = tpm->data.passthrough.source.data.file.path;
|
if (virJSONValueObjectCreate(&props,
|
||||||
|
"s:driver", virDomainTPMModelTypeToString(tpm->model),
|
||||||
|
"s:id", tpm->info.alias,
|
||||||
|
"s:host-path", tpm->data.passthrough.source.data.file.path,
|
||||||
|
NULL) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
virCommandAddArg(cmd, "-device");
|
if (qemuBuildDeviceCommandlineFromJSON(cmd, props, qemuCaps) < 0)
|
||||||
virBufferAsprintf(&buf, "%s,id=%s,host-path=",
|
return -1;
|
||||||
virDomainTPMModelTypeToString(tpm->model),
|
|
||||||
tpm->info.alias);
|
|
||||||
virQEMUBuildBufferEscapeComma(&buf, filePath);
|
|
||||||
virCommandAddArgBuffer(cmd, &buf);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -10007,7 +10008,7 @@ qemuBuildTPMsCommandLine(virCommand *cmd,
|
|||||||
|
|
||||||
for (i = 0; i < def->ntpms; i++) {
|
for (i = 0; i < def->ntpms; i++) {
|
||||||
if (def->tpms[i]->model == VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY) {
|
if (def->tpms[i]->model == VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY) {
|
||||||
if (qemuBuildTPMProxyCommandLine(cmd, def->tpms[i]) < 0)
|
if (qemuBuildTPMProxyCommandLine(cmd, def->tpms[i], qemuCaps) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
} else if (qemuBuildTPMCommandLine(cmd, def,
|
} else if (qemuBuildTPMCommandLine(cmd, def,
|
||||||
def->tpms[i], qemuCaps) < 0) {
|
def->tpms[i], qemuCaps) < 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user