mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Merge pull request #10570 from ahammond/normalize_mapper_mounts
guess at how to solve issue #10257
This commit is contained in:
commit
b67272ea1b
@ -18,6 +18,7 @@ Mount any type of mountable filesystem with the mounted function:
|
||||
|
||||
# Import python libs
|
||||
import os.path
|
||||
import re
|
||||
|
||||
# Import salt libs
|
||||
from salt._compat import string_types
|
||||
@ -90,6 +91,19 @@ def mounted(name,
|
||||
real_device = os.path.realpath(device)
|
||||
else:
|
||||
real_device = device
|
||||
|
||||
# LVS devices have 2 names under /dev:
|
||||
# /dev/mapper/vgname-lvname and /dev/vgname/lvname
|
||||
# No matter what name is used for mounting,
|
||||
# mount always displays the device as /dev/mapper/vgname-lvname
|
||||
# So, let's call that the canonical device name
|
||||
# We should normalize names of the /dev/vgname/lvname type to the canonical name
|
||||
m = re.match(r'^/dev/(?P<vg_name>[^/]+)/(?P<lv_name>[^/]+$)', device)
|
||||
if m:
|
||||
mapper_device = '/dev/mapper/{vg_name}-{lv_name}'.format(**m.groupdict())
|
||||
if os.path.exists(mapper_device):
|
||||
real_device = mapper_device
|
||||
|
||||
device_list = []
|
||||
if real_name in active:
|
||||
device_list.append(active[real_name]['device'])
|
||||
|
Loading…
Reference in New Issue
Block a user