mirror of
https://github.com/rancher/os.git
synced 2025-07-15 15:51:36 +00:00
Merge pull request #910 from joshwget/share-mount
/media and /mnt mounted as shared for console
This commit is contained in:
commit
3c8559a576
@ -224,6 +224,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,
|
||||
}
|
||||
|
||||
|
@ -167,6 +167,8 @@ rancher:
|
||||
- all-volumes
|
||||
volumes:
|
||||
- /usr/bin/iptables:/sbin/iptables:ro
|
||||
- /media:/media:shared
|
||||
- /mnt:/mnt:shared
|
||||
container-data-volumes:
|
||||
image: {{.OS_IMAGES_ROOT}}/os-state:{{.VERSION}}{{.SUFFIX}}
|
||||
labels:
|
||||
|
21
tests/integration/rostest/test_15_shared_mount.py
Normal file
21
tests/integration/rostest/test_15_shared_mount.py
Normal 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))
|
@ -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, ''))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user