Skip to content

Commit

Permalink
kola/spawn: Support enabling swtpm
Browse files Browse the repository at this point in the history
Allow users to create a qemu VM with swtpm through kola spawn. CLI options are
shared between `kola spawn` and `kola run` so add comments informing users that
the option should not be used with `kola run`.

Signed-off-by: Jeremi Piotrowski <[email protected]>
  • Loading branch information
jepio committed Apr 11, 2024
1 parent f3334a7 commit 613b6e6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/kola/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions platform/machine/qemu/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 2 additions & 0 deletions platform/machine/qemu/flight.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ type Options struct {

ExtraBaseDiskSize string

EnableTPM bool

*platform.Options
}

Expand Down

0 comments on commit 613b6e6

Please sign in to comment.