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)
| 73 | // Depending on the Sandbox settings, it may either use the Controller's |
| 74 | // default sandbox, or configure a new one. |
| 75 | func (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 | } |
no test coverage detected