dhiltgen / docker-machine-kvm

KVM driver for docker-machine
Apache License 2.0
377 stars 117 forks source link

Add 9p support for mounting /home #2

Open dhiltgen opened 9 years ago

jimmidyson commented 8 years ago

Any thoughts on this? Would love this for minikube/minishift.

dhiltgen commented 8 years ago

Haven't had the bandwidth to investigate it. Long long ago I played with KVM+9p on a different project and found it was too flaky for what I was trying to do (nested builds within a VM) so I abandoned it. Perhaps things are more stable/reliable now... I'm not sure.

afbjorklund commented 7 years ago

As a workaround, I added a "sshfs"* command: https://github.com/docker/machine/pull/4018 You can use it to mount some machine directory locally (i.e. over SSH).

As far as I know* , 9p is deprecated and vsock is emerging... Which probably leaves NFS or something as the only option.

afbjorklund commented 7 years ago

The current Boot2Docker image still has 9p support, though.

https://github.com/boot2docker/boot2docker/blob/master/kernel_config

CONFIG_NET_9P=y
CONFIG_NET_9P_VIRTIO=y
# CONFIG_NET_9P_DEBUG is not set
CONFIG_9P_FS=y
CONFIG_9P_FS_POSIX_ACL=y
# CONFIG_9P_FS_SECURITY is not set

Then again it still uses AUFS as the storage driver, as well...

https://github.com/boot2docker/boot2docker/blob/master/Dockerfile

# https://www.kernel.org/
ENV KERNEL_VERSION  4.4.74

# http://aufs.sourceforge.net/
ENV AUFS_REPO       https://github.com/sfjro/aufs4-standalone
ENV AUFS_BRANCH     aufs4.4
ENV AUFS_COMMIT     dcfa30307f2a165069545a0ad2094ca31fcb490b

But maybe 9p is still a reasonable option, until virtio-vsock lands ? (and even then, it would still need something like NFS on top of it too)

And it looks like there are SELinux things left to sort out, as well... (even though there might be "Virt-FS" support available in RHEL 7.x)

afbjorklund commented 7 years ago

Using 9p does work OK, but the current boot2docker ISO doesn't mount /hosthome under KVM.

https://github.com/docker/machine/blob/master/drivers/virtualbox/virtualbox_linux.go#L40

https://github.com/docker/machine/blob/master/drivers/virtualbox/virtualbox.go#L445

So it will only mount /Users (Mac) and /C/Users (Win), and only for the VirtualBox driver.


To make this work, there are changes needed both for machine (in driver) and for boot2docker.

https://wiki.qemu.org/Documentation/9psetup

-fsdev local,id=test_dev,path=/home/guest/9p_setup/shared,security_model=none -device virtio-9p-pci,fsdev=test_dev,mount_tag=test_mount

 mount -t 9p -o trans=virtio test_mount /tmp/shared/ -oversion=9p2000.L,posixacl,cache=loose

But whole design, with hardcoding /Users /C/Users /home, seems to be a bit flawed anyway ?