-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Implement virtfs volumes for podman machine #11454
Implement virtfs volumes for podman machine #11454
Conversation
Needs tests or [NO TESTS NEEDED] |
I'm not sure I could find any tests, related to |
848fc0b
to
3268a6c
Compare
LGTM |
Apparently it will need some more QEMU patching, before it (virtfs/9p) will work also on Macs: https://github.com/afbjorklund/qemu/tree/9p-darwin (
Patches originally from https://lists.nongnu.org/archive/html/qemu-devel/2018-05/msg07325.html |
Anybody tried to submit the patches to the upstream recently? |
This comment has been minimized.
This comment has been minimized.
I was able to try it with a patched qemu (hvf + 9p-darwin) on Apple Silicon, and it works OK... There was some trouble connecting due to ssh not being ready and a performance warning:
So there needs to be a sleep before doing the mkdir + mount, and need to set msize > 8192.
But other than those, it was no issue with running
|
Looks like those ssh errors are problems with the gvproxy implementation, rather than a slowness on Mac. Will file a separate bug on those, looks like "gvproxy" is mostly a quick hack (fixed path, no error handling) ? |
2ee66d0
to
e7a5b9e
Compare
Still fails, so should probably check the VM IP for SSH rather than the
But it looks extremely hard-coded and early still, so probably wait for next "gvproxy"... Forwards: map[string]string{
fmt.Sprintf(":%d", sshPort): "192.168.127.2:22",
}, Some arbitrary workaround like sleep, would probably make it work meanwhile. EDIT: Opened containers/gvisor-tap-vsock#42 |
This comment has been minimized.
This comment has been minimized.
LGTM |
I guess I will squash and rebase it, just added some late night hacks 🌃 Will see if adding a Mac-only sleep will work, then I'll update the PR... Did you get a chance to try it yet ? Eventually we need benchmarks, too. |
e7a5b9e
to
12dbe4a
Compare
The sleep didn't seem to help at all, so removing it. Works on Linux, something else is wrong ? Will try again, once machine/gvisor doesn't hardcode the MAC address and IP address... 🙄 |
12dbe4a
to
33577a5
Compare
Note that "isRunning" only checks if the qmp socket is up, not if the machine has started. For that, it needs to run QMP. And that "isListening" only checks if the gvproxy is up, not if the ssh server has started. For that, it needs to run SSH. |
33577a5
to
a28ab5c
Compare
This comment has been minimized.
This comment has been minimized.
a28ab5c
to
dcb62c3
Compare
@afbjorklund I'm trying to replicate this setup (and if it works then perhaps even submit the nix patch set upstream, since it seems like they're happy to have that happen, just don't have the bandwidth. If it gets in in the next few weeks it might even make it to the next point release). However, a question: I've got a Dockerfile with syntax generally following this model:
Running docker-compose up results in: |
Podman mounts _host-dir_ in the host to _machine-dir_ in the Podman machine. | ||
|
||
The root filesystem is mounted read-only in the default operating system, | ||
so mounts must be created under the /mnt directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer needed, with the latest CoreOS
@afbjorklund I actually just filed #12650, I'm convinced the hooks behavior is wrong. An example is there on using the hooks with reference docs. |
Allow using the built-in 9pfs feature of qemu, mounting host directories into vm mountpoints. The volumes are generic, the mounts are specific. Wait for the machine to be "running", otherwise the SSH function might throw an error instead. Increase the default msize from 8 KiB to 128 KiB [NO NEW TESTS NEEDED] Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
There are other mount types available, such as NFS or SMB, or one could use reverse sshfs for better compatibility. It could either be a global option, or it could perhaps be overridden for each volume (like the container volumes). Refactor the creation of the options string or array. Allow specifying the volume as read-only, if desired. [NO NEW TESTS NEEDED] Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
caadc58
to
251c9a7
Compare
@protosam : since the machine volumes are mounted long before any container is started (i.e. when the VM is booted), and since they are unrelated to the container volumes, I don't understand how those OCI hooks would apply to the VM mounts ? |
Use the same type of mounts for all the machine volumes. The default could change in the future, depending on OS. [NO NEW TESTS NEEDED] Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
251c9a7
to
6630e5c
Compare
Until very recently I wasn't aware that Docker for Desktop exposes pretty much all of the host file system by mounting paths for parity in the guest, so That's a lot of surface space to expose from a security perspective; so I have been exploring how to be surgical for a grpc+fuse based file system that I'm writing in Go. |
I think the security and performance implications of the Docker model are well known, which was why I didn't want to copy them over at first... As you mention, it is not only your own user but also all other users on the host. In this compromise, we made it a parameter ( |
Yeah, I agree with the thought process. Curious about something, does the 9p implementation that qemu uses on mac not support creating named pipes and unix socket inodes? All of my testing on the custom qemu build has led me to believe it's not implemented. Though going beyond that I've actually not found a 9pfs server that even supports it. If 9p doesn't support it, nfs might be a better option to parity docker-desktop. This is actually what has led me to writing a fusefs and also I'm targeting gvproxy to deliver file system services. If I can't get my work committed to master when it's done, my backup plan is to just release a drop-in replacement for gvproxy for docker-desktop parity. |
I think it only support files, and not even symlinks. Creating sockets and other special files on a network filesystem is a bit weird ? The user would be much better off using a local filesystem for those, same goes with any heavy duty things like databases or whatnot. Create a local volume, for those ? i.e. |
Haven't been able to figure out if 9pfs even supports implementing mknod (I think it is implementable), but it is desirable because you may want to have the same path accessed between two containers. The kernel in the vm does make it possible to share pipes and sockets between containers. For example with docker-desktop, open two terminals. Terminal 1 do the following.
Now go over to terminal 2 and do this.
Checking back at terminal 1 you will see:
Edit for clarity: |
This comment has been minimized.
This comment has been minimized.
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: afbjorklund, baude The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Allow using the built-in 9pfs feature of qemu,
mounting host directories into vm mountpoints.
https://wiki.qemu.org/Documentation/9psetup
Wait for the machine to be "running", otherwise
the SSH function might throw an error instead.
For #8016
Example usage:
Note: tested on Linux (Ubuntu 20.04)
Edit: tested OK on macOS 11.5 as well (works with some problems, see below for details)
Some directories (most) are read-only on CoreOS, you can work around this by mounting in another location:
podman machine init -v /Users:/mnt/Users
And then remember to add this extra prefix, when bind-mounting from the remote filesystem into the container:
podman --remote run -v /mnt/Users:/Users
This is a nice document on VirtFS : https://www.kernel.org/doc/ols/2010/ols2010-pages-109-120.pdf
Note: CIFS is a dialect of SMB
https://en.wikipedia.org/wiki/9P_(protocol)