1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Windows: OCI remove first start

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2016-09-16 10:41:47 -07:00
parent efe4e914ef
commit f7fd408ba7
7 changed files with 24 additions and 11 deletions

View file

@ -90,6 +90,7 @@ func (daemon *Daemon) StateChanged(id string, e libcontainerd.StateInfo) error {
// Container is already locked in this case
c.SetRunning(int(e.Pid), e.State == libcontainerd.StateStart)
c.HasBeenManuallyStopped = false
c.HasBeenStartedBefore = true
if err := c.ToDisk(); err != nil {
c.Reset(false)
return err

View file

@ -78,9 +78,6 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e
s.Root.Path = c.BaseFS
s.Root.Readonly = c.HostConfig.ReadonlyRootfs
// In s.Windows
s.Windows.FirstStart = !c.HasBeenStartedBefore
// s.Windows.LayerFolder.
m, err := c.RWLayer.Metadata()
if err != nil {

View file

@ -6,5 +6,7 @@ import (
)
func (daemon *Daemon) getLibcontainerdCreateOptions(container *container.Container) (*[]libcontainerd.CreateOption, error) {
return &[]libcontainerd.CreateOption{}, nil
createOptions := []libcontainerd.CreateOption{}
createOptions = append(createOptions, &libcontainerd.FlushOption{IgnoreFlushesDuringBoot: !container.HasBeenStartedBefore})
return &createOptions, nil
}

View file

@ -44,9 +44,8 @@ func (clnt *client) Create(containerID string, checkpoint string, checkpointDir
SystemType: "Container",
Name: containerID,
Owner: defaultOwner,
VolumePath: spec.Root.Path,
IgnoreFlushesDuringBoot: spec.Windows.FirstStart,
IgnoreFlushesDuringBoot: false,
LayerFolderPath: spec.Windows.LayerFolder,
HostName: spec.Hostname,
}
@ -106,6 +105,10 @@ func (clnt *client) Create(containerID string, checkpoint string, checkpointDir
configuration.Servicing = s.IsServicing
break
}
if s, ok := option.(*FlushOption); ok {
configuration.IgnoreFlushesDuringBoot = s.IgnoreFlushesDuringBoot
break
}
}
for _, layerPath := range spec.Windows.LayerPaths {

View file

@ -38,6 +38,13 @@ type ServicingOption struct {
IsServicing bool
}
// FlushOption is an empty CreateOption that signifies if the container should be
// started with flushes ignored until boot has completed. This is an optimisation
// for first boot of a container.
type FlushOption struct {
IgnoreFlushesDuringBoot bool
}
// Checkpoint holds the details of a checkpoint (not supported in windows)
type Checkpoint struct {
Name string

View file

@ -23,6 +23,11 @@ func (s *ServicingOption) Apply(interface{}) error {
return nil
}
// Apply for the flush option is a no-op.
func (s *FlushOption) Apply(interface{}) error {
return nil
}
// buildFromVersion takes an image version string and returns the Windows build
// number. It returns 0 if the build number is not present.
func buildFromVersion(osver string) int {

View file

@ -39,8 +39,6 @@ type Windows struct {
Resources *Resources `json:"resources,omitempty"`
// Networking contains the platform specific network settings for the container.
Networking *Networking `json:"networking,omitempty"`
// FirstStart is used for an optimization on first boot of Windows
FirstStart bool `json:"first_start,omitempty"`
// LayerFolder is the path to the current layer folder
LayerFolder string `json:"layer_folder,omitempty"`
// Layer paths of the parent layers