|
|
@ -441,12 +441,12 @@ def get_linux_mounts(module):
|
|
|
|
src = mnt['src']
|
|
|
|
src = mnt['src']
|
|
|
|
|
|
|
|
|
|
|
|
if mnt['fs'] == 'tmpfs' and mnt['root'] != '/':
|
|
|
|
if mnt['fs'] == 'tmpfs' and mnt['root'] != '/':
|
|
|
|
### Example:
|
|
|
|
# == Example:
|
|
|
|
# 65 19 0:35 / /tmp rw shared:25 - tmpfs tmpfs rw
|
|
|
|
# 65 19 0:35 / /tmp rw shared:25 - tmpfs tmpfs rw
|
|
|
|
# 210 65 0:35 /aaa /tmp/bbb rw shared:25 - tmpfs tmpfs rw
|
|
|
|
# 210 65 0:35 /aaa /tmp/bbb rw shared:25 - tmpfs tmpfs rw
|
|
|
|
### Expected result:
|
|
|
|
# == Expected result:
|
|
|
|
# src=/tmp/aaa
|
|
|
|
# src=/tmp/aaa
|
|
|
|
###
|
|
|
|
# ==
|
|
|
|
|
|
|
|
|
|
|
|
shared = None
|
|
|
|
shared = None
|
|
|
|
|
|
|
|
|
|
|
@ -456,7 +456,7 @@ def get_linux_mounts(module):
|
|
|
|
shared = fld
|
|
|
|
shared = fld
|
|
|
|
|
|
|
|
|
|
|
|
if shared is None:
|
|
|
|
if shared is None:
|
|
|
|
break
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
dest = None
|
|
|
|
dest = None
|
|
|
|
|
|
|
|
|
|
|
@ -471,15 +471,15 @@ def get_linux_mounts(module):
|
|
|
|
if dest is not None:
|
|
|
|
if dest is not None:
|
|
|
|
src = "%s%s" % (dest, mnt['root'])
|
|
|
|
src = "%s%s" % (dest, mnt['root'])
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
break
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
elif mnt['root'] != '/' and len(mnt['fields']) > 0:
|
|
|
|
elif mnt['root'] != '/' and len(mnt['fields']) > 0:
|
|
|
|
### Example:
|
|
|
|
# == Example:
|
|
|
|
# 67 19 8:18 / /mnt/disk2 rw shared:26 - ext4 /dev/sdb2 rw
|
|
|
|
# 67 19 8:18 / /mnt/disk2 rw shared:26 - ext4 /dev/sdb2 rw
|
|
|
|
# 217 65 8:18 /test /tmp/ccc rw shared:26 - ext4 /dev/sdb2 rw
|
|
|
|
# 217 65 8:18 /test /tmp/ccc rw shared:26 - ext4 /dev/sdb2 rw
|
|
|
|
### Expected result:
|
|
|
|
# == Expected result:
|
|
|
|
# src=/mnt/disk2/test
|
|
|
|
# src=/mnt/disk2/test
|
|
|
|
###
|
|
|
|
# ==
|
|
|
|
|
|
|
|
|
|
|
|
# Search for parent
|
|
|
|
# Search for parent
|
|
|
|
for j, m in enumerate(mntinfo):
|
|
|
|
for j, m in enumerate(mntinfo):
|
|
|
@ -490,13 +490,27 @@ def get_linux_mounts(module):
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
elif mnt['root'] != '/' and len(mnt['fields']) == 0:
|
|
|
|
elif mnt['root'] != '/' and len(mnt['fields']) == 0:
|
|
|
|
### Example:
|
|
|
|
# == Example 1:
|
|
|
|
# 27 20 8:1 /tmp/aaa /tmp/bbb rw - ext4 /dev/sdb2 rw
|
|
|
|
# 27 20 8:1 /tmp/aaa /tmp/bbb rw - ext4 /dev/sdb2 rw
|
|
|
|
### Expected result:
|
|
|
|
# == Example 2:
|
|
|
|
|
|
|
|
# 204 136 253:2 /rootfs / rw - ext4 /dev/sdb2 rw
|
|
|
|
|
|
|
|
# 141 140 253:2 /rootfs/tmp/aaa /tmp/bbb rw - ext4 /dev/sdb2 rw
|
|
|
|
|
|
|
|
# == Expected result:
|
|
|
|
# src=/tmp/aaa
|
|
|
|
# src=/tmp/aaa
|
|
|
|
###
|
|
|
|
# ==
|
|
|
|
|
|
|
|
|
|
|
|
src = mnt['root']
|
|
|
|
src = mnt['root']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Search for parent
|
|
|
|
|
|
|
|
for j, m in enumerate(mntinfo):
|
|
|
|
|
|
|
|
if j < i:
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
|
|
|
m['src'] == mnt['src'] and
|
|
|
|
|
|
|
|
mnt['root'].startswith(m['root'])):
|
|
|
|
|
|
|
|
src = src.replace("%s/" % m['root'], '/', 1)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
mounts[mnt['dst']] = {
|
|
|
|
mounts[mnt['dst']] = {
|
|
|
|
'src': src,
|
|
|
|
'src': src,
|
|
|
|
'opts': mnt['opts'],
|
|
|
|
'opts': mnt['opts'],
|
|
|
|