forked from microsoft/hcsshim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged PR 4188258: update hcsshim ado to 43a75bb
Related work items: microsoft#173, microsoft#839, microsoft#856, microsoft#877, microsoft#881, microsoft#886, microsoft#887, microsoft#888, microsoft#889, microsoft#890, microsoft#893, microsoft#894, microsoft#896, microsoft#899, microsoft#900, microsoft#902, microsoft#904, microsoft#905, microsoft#906, microsoft#907, microsoft#908, microsoft#910, microsoft#912, microsoft#913, microsoft#914, microsoft#916, microsoft#918, microsoft#923, microsoft#925, microsoft#926, microsoft#928, microsoft#929, microsoft#932, microsoft#933, microsoft#934, microsoft#938, microsoft#939, microsoft#942, microsoft#943, microsoft#945, microsoft#946, microsoft#947, microsoft#949, microsoft#951, microsoft#952, microsoft#954
- Loading branch information
Showing
1,911 changed files
with
212,665 additions
and
252,812 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
*.exe | ||
.idea | ||
.vscode |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
* @microsoft/containerplat | ||
|
||
* @microsoft/containerplat | ||
|
||
/hcn/* @nagiesek |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/Microsoft/hcsshim/internal/clone" | ||
"github.com/Microsoft/hcsshim/internal/uvm" | ||
) | ||
|
||
// saveAsTemplate saves the UVM and container inside it as a template and also stores the | ||
// relevant information in the registry so that clones can be created from this template. | ||
// Every cloned uvm gets its own NIC and we do not want to create clones of a template | ||
// which still has a NIC attached to it. So remove the NICs attached to the template uvm | ||
// before saving it. | ||
// Similar to the NIC scenario we do not want to create clones from a template with an | ||
// active GCS connection so close the GCS connection too. | ||
func saveAsTemplate(ctx context.Context, templateTask *hcsTask) (err error) { | ||
var utc *uvm.UVMTemplateConfig | ||
var templateConfig *clone.TemplateConfig | ||
|
||
if err = templateTask.host.RemoveAllNICs(ctx); err != nil { | ||
return err | ||
} | ||
|
||
if err = templateTask.host.CloseGCSConnection(); err != nil { | ||
return err | ||
} | ||
|
||
utc, err = templateTask.host.GenerateTemplateConfig() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
templateConfig = &clone.TemplateConfig{ | ||
TemplateUVMID: utc.UVMID, | ||
TemplateUVMResources: utc.Resources, | ||
TemplateUVMCreateOpts: utc.CreateOpts, | ||
TemplateContainerID: templateTask.id, | ||
TemplateContainerSpec: *templateTask.taskSpec, | ||
} | ||
|
||
if err = clone.SaveTemplateConfig(ctx, templateConfig); err != nil { | ||
return err | ||
} | ||
|
||
if err = templateTask.host.SaveAsTemplate(ctx); err != nil { | ||
return err | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/Microsoft/hcsshim/internal/cmd" | ||
"github.com/Microsoft/hcsshim/internal/cow" | ||
"github.com/Microsoft/hcsshim/internal/log" | ||
"github.com/Microsoft/hcsshim/internal/uvm" | ||
"github.com/opencontainers/runtime-spec/specs-go" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
func newClonedExec( | ||
ctx context.Context, | ||
events publisher, | ||
tid string, | ||
host *uvm.UtilityVM, | ||
c cow.Container, | ||
id, bundle string, | ||
isWCOW bool, | ||
spec *specs.Process, | ||
io cmd.UpstreamIO) *clonedExec { | ||
log.G(ctx).WithFields(logrus.Fields{ | ||
"tid": tid, | ||
"eid": id, // Init exec ID is always same as Task ID | ||
"bundle": bundle, | ||
}).Debug("newClonedExec") | ||
|
||
he := &hcsExec{ | ||
events: events, | ||
tid: tid, | ||
host: host, | ||
c: c, | ||
id: id, | ||
bundle: bundle, | ||
isWCOW: isWCOW, | ||
spec: spec, | ||
io: io, | ||
processDone: make(chan struct{}), | ||
state: shimExecStateCreated, | ||
exitStatus: 255, // By design for non-exited process status. | ||
exited: make(chan struct{}), | ||
} | ||
|
||
ce := &clonedExec{ | ||
he, | ||
} | ||
go he.waitForContainerExit() | ||
return ce | ||
} | ||
|
||
var _ = (shimExec)(&clonedExec{}) | ||
|
||
// clonedExec inherits from hcsExec. The only difference between these two is that | ||
// on starting a clonedExec it doesn't attempt to start the container even if the | ||
// exec is the init process. This is because in case of clonedExec the container is | ||
// already running inside the pod. | ||
type clonedExec struct { | ||
*hcsExec | ||
} | ||
|
||
func (ce *clonedExec) Start(ctx context.Context) (err error) { | ||
// A cloned exec should never initialize the container as it should | ||
// already be running. | ||
return ce.startInternal(ctx, false) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.