1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 12:46:49 +00:00

feat(instances): a VM's TPM 2.0 is switched on and off on its Options tab

A VM made without a TPM, a Windows 10 to be upgraded to Windows 11, had
no way to get one but the XML editor. The Options tab has a TPM 2.0
switch, as the RNG one: it adds an emulated TPM of the host's model to
the definition for the next start, or removes it. Its state stays on the
host until the VM is undefined, so a TPM added again has it back. A TPM
the switch did not make (passthrough, 1.2, encrypted, with its own state
path) is left to the XML editor, and a host without swtpm says so.
This commit is contained in:
catborise 2026-11-01 16:38:14 +03:00
parent 2a05576e18
commit e35342bff1
10 changed files with 288 additions and 130 deletions

View file

@ -130,6 +130,11 @@ EDITS = {
lambda t: not t.xpath("devices/rng"),
["devices/rng"], True, False,
),
"set_tpm": (
lambda vm: vm.set_tpm(True),
lambda t: first(t, "devices/tpm/backend/@version") == "2.0",
["devices/tpm"], True, False,
),
"set_on_crash": (
lambda vm: vm.set_on_crash("restart"),
lambda t: t.findtext("on_crash") == "restart",