mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 22:03:49 +03:00
qemu: tpm: do not update profile name for transient domains
If we do not have a persistent definition, there's no point in looking for it since we cannot store it. Also skip the update if the tpm device(s) in the persistent definition are different. This fixes the crash when starting a transient domain. https://issues.redhat.com/browse/RHEL-69774 https://gitlab.com/libvirt/libvirt/-/issues/715 Fixes: d79542eec669eb9c449bb8228179e7a87e768017 Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
c63bdd17b9
commit
81da7a2c2a
@ -190,7 +190,18 @@ qemuExtDevicesStart(virQEMUDriver *driver,
|
|||||||
|
|
||||||
for (i = 0; i < def->ntpms; i++) {
|
for (i = 0; i < def->ntpms; i++) {
|
||||||
virDomainTPMDef *tpm = def->tpms[i];
|
virDomainTPMDef *tpm = def->tpms[i];
|
||||||
virDomainTPMDef *persistentTPMDef = persistentDef->tpms[i];
|
virDomainTPMDef *persistentTPMDef = NULL;
|
||||||
|
|
||||||
|
if (persistentDef) {
|
||||||
|
/* do not try to update the profile in the persistent definition
|
||||||
|
* if the device does not match */
|
||||||
|
if (persistentDef->ntpms == def->ntpms)
|
||||||
|
persistentTPMDef = persistentDef->tpms[i];
|
||||||
|
if (persistentTPMDef &&
|
||||||
|
(persistentTPMDef->type != tpm->type ||
|
||||||
|
persistentTPMDef->model != tpm->model))
|
||||||
|
persistentTPMDef = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (tpm->type == VIR_DOMAIN_TPM_TYPE_EMULATOR &&
|
if (tpm->type == VIR_DOMAIN_TPM_TYPE_EMULATOR &&
|
||||||
qemuExtTPMStart(driver, vm, tpm, persistentTPMDef,
|
qemuExtTPMStart(driver, vm, tpm, persistentTPMDef,
|
||||||
|
@ -773,7 +773,7 @@ qemuTPMEmulatorBuildCommand(virDomainTPMDef *tpm,
|
|||||||
incomingMigration) < 0)
|
incomingMigration) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (run_setup && !incomingMigration &&
|
if (run_setup && !incomingMigration && persistentTPMDef &&
|
||||||
qemuTPMEmulatorUpdateProfileName(&tpm->data.emulator, persistentTPMDef,
|
qemuTPMEmulatorUpdateProfileName(&tpm->data.emulator, persistentTPMDef,
|
||||||
cfg, saveDef) < 0)
|
cfg, saveDef) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user