Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LCOW: Regular mount if only one layer #36052

Merged
merged 1 commit into from
Jan 25, 2018

Conversation

lowenna
Copy link
Member

@lowenna lowenna commented Jan 18, 2018

Signed-off-by: John Howard jhoward@microsoft.com

This is the moby/moby side of the fix to support FROM scratch. If there's only one layer, then don't do an overlay mount, just a regular mount instead. (Note there's opengcs fixes required too for the end-to-end scenario to work, I'm putting those changes together and teasing them apart from my work-in-progress branch where I'm fixing a slew of LCOW bugs)

@gupta-ak @johnstep PTAL.

@@ -304,6 +304,9 @@ func (svm *serviceVM) createUnionMount(mountName string, mvds ...hcsshim.MappedV
cmd = fmt.Sprintf("mount -t overlay overlay -olowerdir=%s %s",
strings.Join(lowerLayers, ","),
mountName)
} else if len(mvds) == 1 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dunno if there ever is a case where mvds[0].ReadOnly && len(mvds) == 1, but I think it makes sense to move this check before the mvds[0].ReadOnly check.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe there is such a case. But yes, I can move it to before.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gupta-ak Updated.

@@ -304,6 +304,9 @@ func (svm *serviceVM) createUnionMount(mountName string, mvds ...hcsshim.MappedV
cmd = fmt.Sprintf("mount -t overlay overlay -olowerdir=%s %s",
strings.Join(lowerLayers, ","),
mountName)
} else if len(mvds) == 1 {
// `FROM SCRATCH` case and the only layer. No overlay required.
cmd = fmt.Sprintf("mount %s %s", mvds[0].ContainerPath, mountName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this cause problems for Diff? The files are normally located in id/upper for the read write layer, so you might want to do "mount %s/upper %s" instead (and create the directory).

Copy link
Member Author

@lowenna lowenna Jan 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't. With this change I can commit and pull images just fine (that go through diff). Note as I mentioned there is another change for opengcs server-side not yet submitted which is required for this change to be complete. This still passes the LCOW validation without regressions. Note also FROM scratch currently doesn't work at all in LCOW

For example, this still works:

PS E:\docker\build\lcow-copy> docker pull --platform=linux ubuntu
Using default tag: latest
latest: Pulling from library/ubuntu
8f7c85c2269a: Pull complete
9e72e494a6dd: Pull complete
3009ec50c887: Pull complete
9d5ffccbec91: Pull complete
e872a2642ce1: Pull complete
Digest: sha256:d3fdf5b1f8e8a155c17d5786280af1f5a04c10e95145a515279cf17abdf0191f
Status: Downloaded newer image for ubuntu:latest
PS E:\docker\build\lcow-copy> docker run -it ubuntu sh
#
# echo foo > a.txt
#
PS E:\docker\build\lcow-copy> docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
de9fffe3fb88        ubuntu              "sh"                15 seconds ago      Exited (0) 2 seconds ago                       vigilant_sammet
PS E:\docker\build\lcow-copy> docker commit de9
sha256:1a1cbb9be1e44cd61b10c3e488229beb0e59e8cf54b7e89d30e673ee20e94d7b
PS E:\docker\build\lcow-copy> docker run --rm 1a1 sh
PS E:\docker\build\lcow-copy> docker run --rm -it 1a1 sh
# ls -l a.txt
-rw-r--r-- 1 root root 4 Jan 18 19:57 a.txt
#
PS E:\docker\build\lcow-copy>

Signed-off-by: John Howard <jhoward@microsoft.com>
@lowenna lowenna force-pushed the jjh/no-overlay-off-only-one-disk branch from 0eacdcf to 420dc4e Compare January 18, 2018 20:02
Copy link
Contributor

@gupta-ak gupta-ak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@johnstep johnstep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lowenna
Copy link
Member Author

lowenna commented Jan 25, 2018

@thaJeztah PTAL. This is one of the moving pieces in getting FROM scratch working in LCOW :)

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@thaJeztah thaJeztah merged commit a8d0e36 into moby:master Jan 25, 2018
@lowenna lowenna deleted the jjh/no-overlay-off-only-one-disk branch January 26, 2018 03:28
@thaJeztah thaJeztah added the area/lcow Issues and PR's related to the experimental LCOW feature label Oct 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/lcow Issues and PR's related to the experimental LCOW feature status/2-code-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants