Merge pull request #2993 from kevpar/lcow-layer-order

Fix LCOW layer ordering
This commit is contained in:
Michael Crosby 2019-02-12 12:21:51 -05:00 committed by GitHub
commit f5b0fa220d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -366,11 +366,11 @@ func writeMountsToConfig(bundle string, mounts []*containerd_types.Mount) error
return errors.Errorf("unsupported mount type '%s'", m.Type)
}
// parentLayerPaths are passed in layerN, layerN-1, ..., layer 0
// parentLayerPaths are passed in:
// layerN, layerN-1, ..., layer0
//
// The OCI spec expects:
// windows-layer order is layerN, layerN-1, ..., layer0, scratch
// lcow-layer order is layer0, layer1, ..., layerN, scratch
// layerN, layerN-1, ..., layer0, scratch
var parentLayerPaths []string
for _, option := range mounts[0].Options {
if strings.HasPrefix(option, mount.ParentLayerPathsFlag) {
@ -382,12 +382,6 @@ func writeMountsToConfig(bundle string, mounts []*containerd_types.Mount) error
}
if m.Type == "lcow-layer" {
// Reverse the lcow-layer parents
for i := len(parentLayerPaths)/2 - 1; i >= 0; i-- {
opp := len(parentLayerPaths) - 1 - i
parentLayerPaths[i], parentLayerPaths[opp] = parentLayerPaths[opp], parentLayerPaths[i]
}
// If we are creating LCOW make sure that spec.Windows is filled out before
// appending layer folders.
if spec.Windows == nil {