Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gcs init args wrapping when ConsolePipe is enabled #1334

Merged
merged 1 commit into from
Mar 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions internal/uvm/create_lcow.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,18 +639,18 @@ func makeLCOWDoc(ctx context.Context, opts *OptionsLCOW, uvm *UtilityVM) (_ *hcs
}

// Inject initial entropy over vsock during init launch.
initArgs := fmt.Sprintf("-e %d", entropyVsockPort)
entropyArgs := fmt.Sprintf("-e %d", entropyVsockPort)

// With default options, run GCS with stderr pointing to the vsock port
// created below in order to forward guest logs to logrus.
initArgs += " /bin/vsockexec"
execCmdArgs := "/bin/vsockexec"

if opts.ForwardStdout {
initArgs += fmt.Sprintf(" -o %d", linuxLogVsockPort)
execCmdArgs += fmt.Sprintf(" -o %d", linuxLogVsockPort)
}

if opts.ForwardStderr {
initArgs += fmt.Sprintf(" -e %d", linuxLogVsockPort)
execCmdArgs += fmt.Sprintf(" -e %d", linuxLogVsockPort)
}

if opts.DisableTimeSyncService {
Expand All @@ -661,15 +661,16 @@ func makeLCOWDoc(ctx context.Context, opts *OptionsLCOW, uvm *UtilityVM) (_ *hcs
opts.ExecCommandLine += " --scrub-logs"
}

initArgs += " " + opts.ExecCommandLine
execCmdArgs += " " + opts.ExecCommandLine

if opts.ProcessDumpLocation != "" {
initArgs += " -core-dump-location " + opts.ProcessDumpLocation
execCmdArgs += " -core-dump-location " + opts.ProcessDumpLocation
}

initArgs := fmt.Sprintf("%s %s", entropyArgs, execCmdArgs)
if vmDebugging {
// Launch a shell on the console.
initArgs = `sh -c "` + initArgs + ` & exec sh"`
initArgs = entropyArgs + ` sh -c "` + execCmdArgs + ` & exec sh"`
}

kernelArgs += fmt.Sprintf(" nr_cpus=%d", opts.ProcessorCount)
Expand All @@ -696,8 +697,9 @@ func makeLCOWDoc(ctx context.Context, opts *OptionsLCOW, uvm *UtilityVM) (_ *hcs
return doc, nil
}

// Creates an HCS compute system representing a utility VM. It consumes a set of options derived
// from various defaults and options expressed as annotations.
// CreateLCOW creates an HCS compute system representing a utility VM. It
// consumes a set of options derived from various defaults and options
// expressed as annotations.
func CreateLCOW(ctx context.Context, opts *OptionsLCOW) (_ *UtilityVM, err error) {
ctx, span := trace.StartSpan(ctx, "uvm::CreateLCOW")
defer span.End()
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.