diff --git a/cmd/kola/options.go b/cmd/kola/options.go index c904e3a3a..b0ad3bd11 100644 --- a/cmd/kola/options.go +++ b/cmd/kola/options.go @@ -227,6 +227,7 @@ func init() { sv(&kola.QEMUOptions.BIOSImage, "qemu-bios", "", "BIOS to use for QEMU vm") bv(&kola.QEMUOptions.UseVanillaImage, "qemu-skip-mangle", false, "don't modify CL disk image to capture console log") sv(&kola.QEMUOptions.ExtraBaseDiskSize, "qemu-grow-base-disk-by", "", "grow base disk by the given size in bytes, following optional 1024-based suffixes are allowed: b (ignored), k, K, M, G, T") + bv(&kola.QEMUOptions.EnableTPM, "qemu-tpm", false, "enable TPM device in QEMU. Requires installing swtpm. Use only with 'kola spawn', test cases are responsible for creating a VM with TPM explicitly.") // BrightBox specific options sv(&kola.BrightboxOptions.ClientID, "brightbox-client-id", "", "Brightbox client ID") diff --git a/platform/machine/qemu/cluster.go b/platform/machine/qemu/cluster.go index 53480a423..3df499663 100644 --- a/platform/machine/qemu/cluster.go +++ b/platform/machine/qemu/cluster.go @@ -43,6 +43,9 @@ type Cluster struct { func (qc *Cluster) NewMachine(userdata *conf.UserData) (platform.Machine, error) { options := platform.MachineOptions{ ExtraPrimaryDiskSize: qc.flight.opts.ExtraBaseDiskSize, + // Use for 'kola spawn'; test cases should pass true through + // NewMachineWithOptions() + EnableTPM: qc.flight.opts.EnableTPM, } return qc.NewMachineWithOptions(userdata, options) } diff --git a/platform/machine/qemu/flight.go b/platform/machine/qemu/flight.go index 2716ed38a..5ec981a10 100644 --- a/platform/machine/qemu/flight.go +++ b/platform/machine/qemu/flight.go @@ -44,6 +44,8 @@ type Options struct { ExtraBaseDiskSize string + EnableTPM bool + *platform.Options }