LCOW differ return ErrNotImplemented for wrong mount type

On Windows the two differs we register by default are the "windows" and
"windows-lcow" differs. The diff service checks if Apply returns
ErrNotImplemented and will move on to the next differ in the line.
The Windows differ makes use of this to fallback to LCOW if it's
determined the mount type passed is incorrect, but the LCOW differ
does not return ErrNotImplemented for the same scenario. This puts
a strict ordering requirement on the default differ entries in the config,
namely that ["windows", "windows-lcow"] will work, as windows will correctly
fall back to the lcow differ, but ["windows-lcow", "windows"] won't as
the diff services Apply will just return the error directly.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
This commit is contained in:
Daniel Canter 2022-06-28 17:19:04 -07:00
parent 78c4d3de72
commit d2588b3fa4

View File

@ -205,7 +205,7 @@ func mountsToLayerAndParents(mounts []mount.Mount) (string, []string, error) {
} }
mnt := mounts[0] mnt := mounts[0]
if mnt.Type != "lcow-layer" { if mnt.Type != "lcow-layer" {
return "", nil, fmt.Errorf("mount layer type must be lcow-layer: %w", errdefs.ErrInvalidArgument) return "", nil, fmt.Errorf("mount layer type must be lcow-layer: %w", errdefs.ErrNotImplemented)
} }
parentLayerPaths, err := mnt.GetParentPaths() parentLayerPaths, err := mnt.GetParentPaths()