Skip to content
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
180 changes: 115 additions & 65 deletions cmd/containerd-shim-runhcs-v1/options/runhcs.pb.go

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

27 changes: 17 additions & 10 deletions cmd/containerd-shim-runhcs-v1/options/runhcs.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ option go_package = "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/

// Options are the set of customizations that can be passed at Create time.
message Options {
// enable debug tracing
// Enable debug tracing (sets the logrus log level to debug). This may be deprecated in the future, prefer
// log_level as this will override debug if both of them are set.
bool debug = 1;

enum DebugType {
Expand Down Expand Up @@ -69,23 +70,29 @@ message Options {
// host and UVM.
bool scale_cpu_limits_to_sandbox = 11;

// default_container_scratch_size_in_gb is the default scratch size (sandbox.vhdx)
// default_container_scratch_size_in_gb is the default scratch size (sandbox.vhdx)
// to be used for containers. Every container will get a sandbox of `size_in_gb` assigned
// instead of the default of 20GB.
// instead of the default of 20GB.
int32 default_container_scratch_size_in_gb = 12;

// default_vm_scratch_size_in_gb is the default scratch size (sandbox.vhdx)
// to be used for the UVM. This only applies to WCOW as LCOW doesn't mount a scratch
// default_vm_scratch_size_in_gb is the default scratch size (sandbox.vhdx)
// to be used for the UVM. This only applies to WCOW as LCOW doesn't mount a scratch
// specifically for the UVM.
int32 default_vm_scratch_size_in_gb = 13;

// share_scratch specifies if we'd like to reuse scratch space between multiple containers.
// share_scratch specifies if we'd like to reuse scratch space between multiple containers.
// This currently only affects LCOW. The sandbox containers scratch space is re-used for all
// subsequent containers launched in the pod.
// subsequent containers launched in the pod.
bool share_scratch = 14;
//NCProxyAddr is the address of the network configuration proxy service. If omitted
// the network is setup locally.
string NCProxyAddr = 15;

// NCProxyAddr is the address of the network configuration proxy service. If omitted
// the network is setup locally.
string NCProxyAddr = 15;

// log_level specifies the logrus log level for the shim. Supported values are a string representation of the
// logrus log levels: "trace", "debug", "info", "warn", "error", "fatal", "panic". This setting will override
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to make an enum for this?

Copy link
Copy Markdown
Contributor Author

@dcantah dcantah Jul 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to have to supply 0-n for the setting in the containerd config, it seems more intuitive to supply "debug", "warning" etc. as a user then have to remember/figure out what number corresponds to what level. Also makes it so you can feed the string directly to logrus

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that's fine

// the `debug` field if both are specified, unless the level specified is also "debug", as these are equivalent.
string log_level = 16;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we have code explaining the relationship between log_level and debug, but could we add a comment for log_level also?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}

// ProcessDetails contains additional information about a process. This is the additional
Expand Down
16 changes: 16 additions & 0 deletions cmd/containerd-shim-runhcs-v1/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,26 @@ var serveCommand = cli.Command{
shimOpts = newShimOpts
}

if shimOpts.Debug && shimOpts.LogLevel != "" {
logrus.Warning("Both Debug and LogLevel specified, Debug will be overriden")
}

// For now keep supporting the debug option, this used to be the only way to specify a different logging
// level for the shim.
if shimOpts.Debug {
logrus.SetLevel(logrus.DebugLevel)
}

// If log level is specified, set the corresponding logrus logging level. This overrides the debug option
// (unless the level being asked for IS debug also, then this doesn't do much).
if shimOpts.LogLevel != "" {
lvl, err := logrus.ParseLevel(shimOpts.LogLevel)
if err != nil {
return errors.Wrapf(err, "failed to parse shim log level %q", shimOpts.LogLevel)
}
logrus.SetLevel(lvl)
}

switch shimOpts.DebugType {
case runhcsopts.Options_NPIPE:
logrus.SetFormatter(&logrus.TextFormatter{
Expand Down