Skip to content

Commit f5b0fa2

Browse files
Merge pull request #2993 from kevpar/lcow-layer-order
Fix LCOW layer ordering
2 parents cb748db + 225d9b1 commit f5b0fa2

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

runtime/v2/runhcs/service.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,11 @@ func writeMountsToConfig(bundle string, mounts []*containerd_types.Mount) error
366366
return errors.Errorf("unsupported mount type '%s'", m.Type)
367367
}
368368

369-
// parentLayerPaths are passed in layerN, layerN-1, ..., layer 0
369+
// parentLayerPaths are passed in:
370+
// layerN, layerN-1, ..., layer0
370371
//
371372
// The OCI spec expects:
372-
// windows-layer order is layerN, layerN-1, ..., layer0, scratch
373-
// lcow-layer order is layer0, layer1, ..., layerN, scratch
373+
// layerN, layerN-1, ..., layer0, scratch
374374
var parentLayerPaths []string
375375
for _, option := range mounts[0].Options {
376376
if strings.HasPrefix(option, mount.ParentLayerPathsFlag) {
@@ -382,12 +382,6 @@ func writeMountsToConfig(bundle string, mounts []*containerd_types.Mount) error
382382
}
383383

384384
if m.Type == "lcow-layer" {
385-
// Reverse the lcow-layer parents
386-
for i := len(parentLayerPaths)/2 - 1; i >= 0; i-- {
387-
opp := len(parentLayerPaths) - 1 - i
388-
parentLayerPaths[i], parentLayerPaths[opp] = parentLayerPaths[opp], parentLayerPaths[i]
389-
}
390-
391385
// If we are creating LCOW make sure that spec.Windows is filled out before
392386
// appending layer folders.
393387
if spec.Windows == nil {

0 commit comments

Comments
 (0)