Skip to content

Commit

Permalink
kola: Add --qemu-bind-ro
Browse files Browse the repository at this point in the history
I'm trying to debug
`kola run --ssh-on-test-failure ext.rpm-ostree.destructive.container-image`
interactively but one problem is that because the test is classified
as disconnected, we run qemu with no networking.  This makes
it impossible to get remote debug tools.

With this I can `--qemu-bind-ro /usr` to get access to the debug
tools in my dev container's `/usr`.  But one needs to manually mount
inside the VM, because injecting the mount into the Ignition
config in kola is a bit trickier.

For reference it looks like e.g.
`mount -t 9p -o trans=virtio,version=9p2000.L /kola/usr /run/hostusr`
in the ssh shell.
  • Loading branch information
cgwalters committed Sep 13, 2023
1 parent a1a0047 commit d812406
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions mantle/cmd/kola/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ func init() {
bv(&kola.QEMUOptions.Native4k, "qemu-native-4k", false, "Force 4k sectors for main disk")
bv(&kola.QEMUOptions.Nvme, "qemu-nvme", false, "Use NVMe for main disk")
bv(&kola.QEMUOptions.Swtpm, "qemu-swtpm", true, "Create temporary software TPM")
ssv(&kola.QEMUOptions.BindRO, "qemu-bind-ro", nil, "Inject a host directory; this does not automatically mount in the guest")

sv(&kola.QEMUIsoOptions.IsoPath, "qemu-iso", "", "path to CoreOS ISO image")
bv(&kola.QEMUIsoOptions.AsDisk, "qemu-iso-as-disk", false, "attach ISO image as regular disk")
Expand Down
8 changes: 8 additions & 0 deletions mantle/platform/machine/qemu/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"os"
"path/filepath"
"strconv"
"strings"

"sync"
"time"
Expand Down Expand Up @@ -120,6 +121,13 @@ func (qc *Cluster) NewMachineWithQemuOptions(userdata *conf.UserData, options pl
builder.Hostname = fmt.Sprintf("qemu%d", qc.BaseCluster.AllocateMachineSerial())
builder.ConsoleFile = qm.consolePath

// This one doesn't support configuring the path because we can't
// reliably change the Ignition config here...
for _, path := range qc.flight.opts.BindRO {
destpathrel := strings.TrimLeft(path, "/")
builder.Mount9p(path, "/kola/host/"+destpathrel, true)
}

if qc.flight.opts.Memory != "" {
memory, err := strconv.ParseInt(qc.flight.opts.Memory, 10, 32)
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions mantle/platform/machine/qemu/flight.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ type Options struct {
//Option to create a temporary software TPM - true by default
Swtpm bool

// Array of $hostpath
BindRO []string

//IBM Secure Execution
SecureExecution bool
SecureExecutionIgnitionPubKey string
Expand Down

0 comments on commit d812406

Please sign in to comment.