mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: Move TPM command line build code into own function
Move the TPM command line build code into its own function. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
parent
a06e9ce11d
commit
42bee147fe
@ -8192,6 +8192,30 @@ qemuBuildDomainLoaderCommandLine(virCommandPtr cmd,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
qemuBuildTPMCommandLine(virDomainDefPtr def,
|
||||||
|
virCommandPtr cmd,
|
||||||
|
virQEMUCapsPtr qemuCaps,
|
||||||
|
const char *emulator)
|
||||||
|
{
|
||||||
|
char *optstr;
|
||||||
|
|
||||||
|
if (!(optstr = qemuBuildTPMBackendStr(def, qemuCaps, emulator)))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
virCommandAddArgList(cmd, "-tpmdev", optstr, NULL);
|
||||||
|
VIR_FREE(optstr);
|
||||||
|
|
||||||
|
if (!(optstr = qemuBuildTPMDevStr(def, qemuCaps, emulator)))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
virCommandAddArgList(cmd, "-device", optstr, NULL);
|
||||||
|
VIR_FREE(optstr);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
qemuBuildCommandLineCallbacks buildCommandLineCallbacks = {
|
qemuBuildCommandLineCallbacks buildCommandLineCallbacks = {
|
||||||
.qemuGetSCSIDeviceSgName = virSCSIDeviceGetSgName,
|
.qemuGetSCSIDeviceSgName = virSCSIDeviceGetSgName,
|
||||||
};
|
};
|
||||||
@ -9601,19 +9625,8 @@ qemuBuildCommandLine(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (def->tpm) {
|
if (def->tpm) {
|
||||||
char *optstr;
|
if (qemuBuildTPMCommandLine(def, cmd, qemuCaps, emulator) < 0)
|
||||||
|
|
||||||
if (!(optstr = qemuBuildTPMBackendStr(def, qemuCaps, emulator)))
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
virCommandAddArgList(cmd, "-tpmdev", optstr, NULL);
|
|
||||||
VIR_FREE(optstr);
|
|
||||||
|
|
||||||
if (!(optstr = qemuBuildTPMDevStr(def, qemuCaps, emulator)))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
virCommandAddArgList(cmd, "-device", optstr, NULL);
|
|
||||||
VIR_FREE(optstr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < def->ninputs; i++) {
|
for (i = 0; i < def->ninputs; i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user