Skip to content

Commit

Permalink
kola: Fix path for qemu-bios argument
Browse files Browse the repository at this point in the history
After changing the qemu working directory, relative qemu-bios path
arguments stopped working.
Handle relative paths by prepending kola's current working directory.
The changes from
git diff --no-index platform/machine/qemu/ platform/machine/unprivqemu/
show that only platform-specific options differ. As a test
cl.tpm.root-cryptenroll passed for --platform=qemu and
--platform=qemu-unpriv when run with
--qemu-bios=flatcar_production_qemu_uefi_efi_code.fd as relative path
argument.
  • Loading branch information
pothos committed Apr 19, 2024
1 parent 7182ed3 commit 473af26
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion platform/machine/qemu/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,15 @@ ExecStartPost=/usr/bin/ln -fs /run/metadata/flatcar /run/metadata/coreos

// This uses path arguments with path values being
// relative to the folder created for this machine
qmCmd, extraFiles, err := platform.CreateQEMUCommand(qc.flight.opts.Board, qm.id, qc.flight.opts.BIOSImage, qm.consolePath, confPath, qc.flight.diskImagePath, conf.IsIgnition(), options)
biosImage := qc.flight.opts.BIOSImage
if !strings.HasPrefix(biosImage, "/") {
cwd, err := os.Getwd()
if err != nil {
return nil, fmt.Errorf("getting cwd: %v", err)
}
biosImage = filepath.Join(cwd, biosImage)
}
qmCmd, extraFiles, err := platform.CreateQEMUCommand(qc.flight.opts.Board, qm.id, biosImage, qm.consolePath, confPath, qc.flight.diskImagePath, conf.IsIgnition(), options)
if err != nil {
return nil, err
}
Expand Down
10 changes: 9 additions & 1 deletion platform/machine/unprivqemu/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,15 @@ LinkLocalAddressing=no
}
// This uses path arguments with path values being
// relative to the folder created for this machine
qmCmd, extraFiles, err := platform.CreateQEMUCommand(qc.flight.opts.Board, qm.id, qc.flight.opts.BIOSImage, qm.consolePath, confPath, qc.flight.diskImagePath, conf.IsIgnition(), options)
biosImage := qc.flight.opts.BIOSImage
if !strings.HasPrefix(biosImage, "/") {
cwd, err := os.Getwd()
if err != nil {
return nil, fmt.Errorf("getting cwd: %v", err)
}
biosImage = filepath.Join(cwd, biosImage)
}
qmCmd, extraFiles, err := platform.CreateQEMUCommand(qc.flight.opts.Board, qm.id, biosImage, qm.consolePath, confPath, qc.flight.diskImagePath, conf.IsIgnition(), options)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 473af26

Please sign in to comment.