Skip to content

Commit dda2136

Browse files
committed
fix rebase errors
Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
1 parent e174935 commit dda2136

3 files changed

Lines changed: 16 additions & 14 deletions

File tree

cmd/containerd-shim-lcow-v2/service/service.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"fmt"
88
"sync"
99

10-
"github.com/Microsoft/hcsshim/internal/builder/vm/lcow"
1110
"github.com/Microsoft/hcsshim/internal/controller/pod"
1211
"github.com/Microsoft/hcsshim/internal/controller/vm"
1312
"github.com/Microsoft/hcsshim/internal/log"

cmd/containerd-shim-lcow-v2/service/service_task.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ func (s *Service) Stats(ctx context.Context, request *task.StatsRequest) (resp *
304304
// Connect reconnects to a running task.
305305
// This method is part of the instrumentation layer and business logic is included in connectInternal.
306306
func (s *Service) Connect(ctx context.Context, request *task.ConnectRequest) (resp *task.ConnectResponse, err error) {
307-
ctx, span := oc.StartSpan(ctx, "Connect")
307+
_, span := oc.StartSpan(ctx, "Connect")
308308
defer span.End()
309309
defer func() {
310310
if resp != nil {

cmd/containerd-shim-lcow-v2/service/service_task_internal.go

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ import (
99
"os"
1010
"path/filepath"
1111

12-
"github.com/Microsoft/hcsshim/internal/controller/linuxcontainer"
13-
"github.com/Microsoft/hcsshim/internal/controller/network"
12+
container "github.com/Microsoft/hcsshim/internal/controller/linuxcontainer"
1413
"github.com/Microsoft/hcsshim/internal/controller/pod"
1514
"github.com/Microsoft/hcsshim/internal/controller/process"
1615
"github.com/Microsoft/hcsshim/internal/hcs"
@@ -34,7 +33,7 @@ import (
3433
)
3534

3635
// getContainerController looks up the container controller for the given container ID.
37-
func (s *Service) getContainerController(containerID string) (*linuxcontainer.Controller, error) {
36+
func (s *Service) getContainerController(containerID string) (*container.Controller, error) {
3837
s.mu.RLock()
3938
defer s.mu.RUnlock()
4039

@@ -118,7 +117,7 @@ func (s *Service) createInternal(ctx context.Context, request *task.CreateTaskRe
118117
s.mu.Lock()
119118
defer s.mu.Unlock()
120119

121-
var ctrCtrl *linuxcontainer.Controller
120+
var ctrCtrl *container.Controller
122121

123122
switch ct {
124123
case oci.KubernetesContainerTypeSandbox:
@@ -138,13 +137,10 @@ func (s *Service) createInternal(ctx context.Context, request *task.CreateTaskRe
138137
}
139138

140139
// Create a new pod.
141-
podCtrl := pod.New(sid, s.vmController)
140+
podCtrl := pod.New(sid, spec.Windows.Network.NetworkNamespace, s.vmController)
142141

143142
// Setup network for the pod based on the provided namespace.
144-
err = podCtrl.SetupNetwork(ctx, &network.SetupOptions{
145-
NetworkNamespace: spec.Windows.Network.NetworkNamespace,
146-
PolicyBasedRouting: s.sandboxOptions.PolicyBasedRouting,
147-
})
143+
err = podCtrl.SetupNetwork(ctx)
148144
if err != nil {
149145
// No cleanup on failure since containerd will send a Delete request.
150146
return nil, fmt.Errorf("failed to setup network for pod %s: %w", sid, err)
@@ -180,13 +176,20 @@ func (s *Service) createInternal(ctx context.Context, request *task.CreateTaskRe
180176
return nil, fmt.Errorf("unsupported container type %q: %w", ct, errdefs.ErrInvalidArgument)
181177
}
182178

179+
// Get EnableScratchEncryption option.
180+
var enableScratchEncryption bool
181+
sandboxOpts := s.vmController.SandboxOptions()
182+
if sandboxOpts != nil {
183+
enableScratchEncryption = sandboxOpts.EnableScratchEncryption
184+
}
185+
183186
// Call Create on the container controller.
184187
if err := ctrCtrl.Create(
185188
ctx,
186189
&spec,
187190
request,
188-
&linuxcontainer.CreateOpts{
189-
IsScratchEncryptionEnabled: s.sandboxOptions.EnableScratchEncryption,
191+
&container.CreateOpts{
192+
IsScratchEncryptionEnabled: enableScratchEncryption,
190193
},
191194
); err != nil {
192195
return nil, fmt.Errorf("failed to create container %s: %w", request.ID, err)
@@ -411,7 +414,7 @@ func (s *Service) killInternal(ctx context.Context, request *task.KillRequest) (
411414

412415
// If "all" is set and this is a sandbox (pod) container, collect all
413416
// workload containers so we can fan out the kill to the entire pod.
414-
var workloadContainers map[string]*linuxcontainer.Controller
417+
var workloadContainers map[string]*container.Controller
415418
if request.All {
416419
if podCtrl, ok := s.getPodController(request.ID); ok {
417420
workloadContainers = podCtrl.ListContainers()

0 commit comments

Comments
 (0)