1
0
mirror of https://github.com/rancher/os.git synced 2025-08-31 14:23:11 +00:00

/media and /mnt mounted as shared for console

This commit is contained in:
Josh Curl
2016-05-04 16:18:24 -07:00
committed by Darren Shepherd
parent 3728a328ea
commit 9f0074c398
4 changed files with 31 additions and 0 deletions

View File

@@ -218,6 +218,9 @@ func RunInit() error {
return c, dockerlaunch.PrepareFs(&mountConfig)
},
initializeSelinux,
func(c *config.CloudConfig) (*config.CloudConfig, error) {
return c, syscall.Mount("", "/", "", syscall.MS_SHARED|syscall.MS_REC, "")
},
sysInit,
}

View File

@@ -171,6 +171,8 @@ rancher:
- all-volumes
volumes:
- /usr/bin/iptables:/sbin/iptables:ro
- /media:/media:shared
- /mnt:/mnt:shared
container-data-volumes:
image: {{.OS_REPO}}/os-state:{{.VERSION}}{{.SUFFIX}}
labels:

View File

@@ -0,0 +1,21 @@
import pytest
import rostest.util as u
from rostest.util import SSH
@pytest.fixture(scope="module")
def qemu(request):
q = u.run_qemu(request)
u.flush_out(q.stdout)
return q
def test_shared_mount(qemu):
SSH(qemu).check_call('''
set -x -e
sudo mkdir /mnt/shared
sudo touch /test
sudo system-docker run --privileged -v /mnt:/mnt:shared -v /test:/test {busybox_image} mount --bind / /mnt/shared
ls /mnt/shared | grep test
'''.format(busybox_image=u.busybox_image))

View File

@@ -15,6 +15,11 @@ if arch != 'amd64':
suffix = '_' + arch
busybox_image = {'amd64': 'busybox',
'arm': 'armhf/busybox',
'arm64': 'aarch64/busybox'}[arch]
def iter_lines(s):
return it.imap(str.rstrip, iter(s.readline, ''))