MCPcopy
hub / github.com/moby/moby / setupOSLSandbox

Method setupOSLSandbox

daemon/libnetwork/controller_linux.go:75–104  ·  view source on GitHub ↗

setupOSLSandbox sets the sandbox [osl.Sandbox], and applies operating- specific configuration. Depending on the Sandbox settings, it may either use the Controller's default sandbox, or configure a new one.

(sb *Sandbox)

Source from the content-addressed store, hash-verified

73// Depending on the Sandbox settings, it may either use the Controller's
74// default sandbox, or configure a new one.
75func (c *Controller) setupOSLSandbox(sb *Sandbox) error {
76 if sb.config.useDefaultSandBox {
77 defSB, err := c.getDefaultOSLSandbox(sb.Key())
78 if err != nil {
79 return err
80 }
81 sb.osSbox = defSB
82 }
83
84 if sb.osSbox == nil && !sb.config.useExternalKey {
85 newSB, err := osl.NewSandbox(sb.Key(), !sb.config.useDefaultSandBox, false)
86 if err != nil {
87 return fmt.Errorf("failed to create new osl sandbox: %v", err)
88 }
89 sb.osSbox = newSB
90 }
91
92 if sb.osSbox != nil {
93 // Apply operating specific knobs on the load balancer sandbox
94 err := sb.osSbox.InvokeFunc(func() {
95 sb.osSbox.ApplyOSTweaks(sb.oslTypes)
96 })
97 if err != nil {
98 log.G(context.TODO()).Errorf("Failed to apply performance tuning sysctls to the sandbox: %v", err)
99 }
100 // Keep this just so performance is not changed
101 sb.osSbox.ApplyOSTweaks(sb.oslTypes)
102 }
103 return nil
104}

Callers 1

NewSandboxMethod · 0.95

Calls 6

getDefaultOSLSandboxMethod · 0.95
NewSandboxFunction · 0.92
ErrorfMethod · 0.80
InvokeFuncMethod · 0.80
ApplyOSTweaksMethod · 0.80
KeyMethod · 0.65

Tested by

no test coverage detected