Skip to content

Commit

Permalink
executor: Expose guest kernel args to log
Browse files Browse the repository at this point in the history
It makes sense to log the guest's kernel args for debugging purposes.

Signed-off-by: Ram Lavi <[email protected]>
  • Loading branch information
RamLavi committed Jan 10, 2024
1 parent 8121a4f commit b5db4d2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/internal/checkup/executor/console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ func RetValue(retcode string) string {
return "\n" + retcode + CRLF + ".*" + PromptExpression
}

func (e Expecter) GetGuestKernelArgs() (string, error) {
const cmdLineCmd = "cat /proc/cmdline\n"
batch := []expect.Batcher{
&expect.BSnd{S: cmdLineCmd},
&expect.BExp{R: PromptExpression},
}
const printKernelArgsTimeout = 30 * time.Second
resp, err := e.SafeExpectBatchWithResponse(batch, printKernelArgsTimeout)
return resp[0].Output, err
}

// SafeExpectBatchWithResponse runs the batch from `expected`, connecting to a VMI's console and
// waiting for the batch to return with a response until timeout.
// It validates that the commands arrive to the console.
Expand Down
3 changes: 3 additions & 0 deletions pkg/internal/checkup/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ func (e Executor) Execute(ctx context.Context, vmiUnderTestName string) (status.
return status.Results{}, fmt.Errorf("failed to login to VMI \"%s/%s\": %w", e.namespace, vmiUnderTestName, err)
}

kernelArgs, _ := vmiUnderTestConsoleExpecter.GetGuestKernelArgs()
log.Printf("VMI under test guest kernel Args: %s", kernelArgs)

oslatClient := oslat.NewClient(vmiUnderTestConsoleExpecter, e.OslatDuration)
log.Printf("Running Oslat test on VMI under test for %s...", e.OslatDuration.String())
maxLatency, err := oslatClient.Run(ctx)
Expand Down

0 comments on commit b5db4d2

Please sign in to comment.