Merge pull request #43735 from ndeloof/containerd-snapshotter-ff
introduce Containerd-snapshotter feature flag
This commit is contained in:
commit
094069adc7
2 changed files with 16 additions and 4 deletions
|
@ -147,6 +147,16 @@ func (daemon *Daemon) Features() *map[string]bool {
|
|||
return &daemon.configStore.Features
|
||||
}
|
||||
|
||||
// usesSnapshotter returns true if feature flag to use containerd snapshotter is enabled
|
||||
func (daemon *Daemon) usesSnapshotter() bool {
|
||||
if daemon.configStore.Features != nil {
|
||||
if b, ok := daemon.configStore.Features["containerd-snapshotter"]; ok {
|
||||
return b
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// RegistryHosts returns registry configuration in containerd resolvers format
|
||||
func (daemon *Daemon) RegistryHosts() docker.RegistryHosts {
|
||||
var (
|
||||
|
|
|
@ -720,16 +720,18 @@ func sysctlExists(s string) bool {
|
|||
// WithCommonOptions sets common docker options
|
||||
func WithCommonOptions(daemon *Daemon, c *container.Container) coci.SpecOpts {
|
||||
return func(ctx context.Context, _ coci.Client, _ *containers.Container, s *coci.Spec) error {
|
||||
if c.BaseFS == nil {
|
||||
if c.BaseFS == nil && !daemon.usesSnapshotter() {
|
||||
return errors.New("populateCommonSpec: BaseFS of container " + c.ID + " is unexpectedly nil")
|
||||
}
|
||||
linkedEnv, err := daemon.setupLinkedContainers(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
s.Root = &specs.Root{
|
||||
Path: c.BaseFS.Path(),
|
||||
Readonly: c.HostConfig.ReadonlyRootfs,
|
||||
if !daemon.usesSnapshotter() {
|
||||
s.Root = &specs.Root{
|
||||
Path: c.BaseFS.Path(),
|
||||
Readonly: c.HostConfig.ReadonlyRootfs,
|
||||
}
|
||||
}
|
||||
if err := c.SetupWorkingDirectory(daemon.idMapping.RootPair()); err != nil {
|
||||
return err
|
||||
|
|
Loading…
Add table
Reference in a new issue