[WIP] Implement Windows snapshotter and differ#1613
[WIP] Implement Windows snapshotter and differ#1613darstahl wants to merge 1 commit intocontainerd:masterfrom
Conversation
38400c4 to
9b3b782
Compare
There was a problem hiding this comment.
if s := strings.ToLower(fsType); s != "ntfs" {
return nil, errors.Wrapf(errdefs.ErrInvalidArgument, "%s is on an non-NTFS volume (%s) - only NTFS volumes are supported", root, s)
}There was a problem hiding this comment.
Question: why single-mount is unimplementable?
If unimplementable, please add a comment to the source code?
There was a problem hiding this comment.
I'll add a comment. This is due to the filesystem filter on Windows. When accessing a file in an underlying layer, there needs to be a target in the current layer, so a hardlink is created, pointing to the lower layer file (essentially). This means that without the lower layers, the current layer would be full of dead links. As a result, mounting a single layer would be all but useless, so the only API exposed to mount layers on Windows requires all layers.
There was a problem hiding this comment.
Is this constant can be defined in hccshim package?
There was a problem hiding this comment.
If not, can we have it exported to use outside of this package (I've left a comment a bit above asking to add a constant)
There was a problem hiding this comment.
Yes, this will be a constant in hcsshim package and not hard coded.
mlaventure
left a comment
There was a problem hiding this comment.
Looks like a promising start! 🎉
There was a problem hiding this comment.
you can just remove that function, it does nothing on other platforms either.
There was a problem hiding this comment.
nit: merge in the var () block below
There was a problem hiding this comment.
Done. FYI I plan to move some of the responsibility here to hcsshim, so the differ will still be undergoing some largeish changes
There was a problem hiding this comment.
nit: s/NewWindowsDiff/It/
also, is that true even unix FS? (e.g. zfs)?
There was a problem hiding this comment.
copy paste error. This is expected to only work on NTFS (and is not a generic implementation, but a Windows container specific one)
There was a problem hiding this comment.
There was a problem hiding this comment.
nit: just a preference, I think a switch construct here would make it easier to read (feel free to ignore if you like it that way 😇)
There was a problem hiding this comment.
do we need to call t.Rollback() here? maybe put it in a defer.
There was a problem hiding this comment.
I think a Rollback is needed. Other snapshotters have the same function without a rollback (I see a few missing Rollbacks in Naive and Overlay actually). I think we might need to do a pass on all snapshotters.
There was a problem hiding this comment.
I'm not sure I like the defer, as some functions have a return t.Commit(), which looks fine, and could easily be introduced again if changed to err = t.Commit(); return err but would not trigger the defer on failure. I'm not sure what the pattern should be. Maybe a defer with an explicit variable such as doNotRollback which must be set on a Commit succeeding?
There was a problem hiding this comment.
I think that if the function returned are named, you should be able to rely on this and only rollback if err != nil.
There was a problem hiding this comment.
shouldn't this be done later? Otherwise we're not going to rollback the transaction here.
There was a problem hiding this comment.
ID is only needed to get the disk usage. Removed.
There was a problem hiding this comment.
Why is there another fork of the tar package?
There was a problem hiding this comment.
I'll get back to you on this. There was something that needed to be forked due to layer implementation on Windows IIRC, but this was done a long time ago
There was a problem hiding this comment.
Could you leave the type definition near the New function?
There was a problem hiding this comment.
Do we want to upstream this to continuity?
There was a problem hiding this comment.
That sounds good to me.
|
@darrenstahlmsft This is a really solid start! The snapshotter model seems to be holding up, although we may need to rethink how the related mounts work. Would it be possible to get the whole structure into a single mount call? |
There was a problem hiding this comment.
Afaics this function doesn't actually mount anything and the actual mount is in https://github.com/containerd/containerd/pull/1613/files#diff-c3cba80ac2b534161f3d1259da272c21R80 and doesn't have really much to do with snapshots as all the inputs come from a spec. This makes the API very inconsistent for anything that calls this function directly instead of just creating a container what internally calls here and atm there isn't a public method for mounting a snapshot.
There was a problem hiding this comment.
This does do the mount to host (PrepareLayer mounts the layers), but on Windows, you cannot specify a target location. Instead, the layers are exposed as a VHD mounted on the host. The linked code just retrieves the already mounted path from HCS.
I agree that this function does not do what it says on the box here on Windows. We'll need to work out a way to expose what this really does via a different function, or otherwise make it do what it says. Having target as a parameter to the mount does not really make sense on Windows layer mounting.
4633a57 to
30b412e
Compare
|
Running tests is timing out on Windows waiting for start. I'm not sure why yet. |
|
Pushed an update to address most of the feeback, and rebased Next step: Moving archive logic around into more permanent locations |
Signed-off-by: Darren Stahl <[email protected]>
30b412e to
3d04e90
Compare
This is a work in progress (nearly finished) implementation of snapshotter and differ on Windows and the corresponding changes in ctr and Windows runtime to use the new snapshotter/differ.
Work left to be done is as follows:
cc @mlaventure @dmcgowan @stevvooe @crosbymichael
Signed-off-by: Darren Stahl [email protected]