Skip to content

Commit

Permalink
New method to handle nodev filesystems
Browse files Browse the repository at this point in the history
Handling nodev filesystems was originally part of getActiveMounts
method that is no longer needed.

Signed-off-by: Vojtech Trefny <vtrefny@redhat.com>
  • Loading branch information
vojtechtrefny committed Mar 18, 2015
1 parent 6ca637e commit 8a7ac5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 22 deletions.
2 changes: 1 addition & 1 deletion blivet/__init__.py
Expand Up @@ -387,7 +387,7 @@ def reset(self, cleanupOnly=False):
self.dumpState("initial")

if not flags.installer_mode:
self.devicetree.getActiveMounts()
self.devicetree.handleNodevFilesystems()

self.updateBootLoaderDiskList()

Expand Down
23 changes: 2 additions & 21 deletions blivet/devicetree.py
Expand Up @@ -2649,27 +2649,15 @@ def resolveDevice(self, devspec, blkidTab=None, cryptTab=None, options=None):
log.debug("failed to resolve '%s'", devspec)
return device

def getActiveMounts(self):
""" Reflect active mounts in the appropriate devices' formats. """
log.info("collecting information about active mounts")
def handleNodevFilesystems(self):

for line in open("/proc/mounts").readlines():
try:
(devspec, mountpoint, fstype, options, _rest) = line.split(None, 4)
except ValueError:
log.error("failed to parse /proc/mounts line: %s", line)
continue

if fstype == "btrfs":
# get the subvol name from /proc/self/mountinfo
for line in open("/proc/self/mountinfo").readlines():
fields = line.split()
_subvol = fields[3]
_mountpoint = fields[4]
_devspec = fields[9]
if _mountpoint == mountpoint and _devspec == devspec:
log.debug("subvol %s", _subvol)
options += ",subvol=%s" % _subvol[1:]

if fstype in nodev_filesystems:
if not flags.include_nodev:
continue
Expand All @@ -2691,10 +2679,3 @@ def getActiveMounts(self):
n = len([d for d in self.devices if d.format.type == fstype])
device._name += ".%d" % n
self._addDevice(device)
devspec = device.name

device = self.resolveDevice(devspec, options=options)
if device is not None:
device.format.mountpoint = mountpoint # for future mounts
device.format._mountpoint = mountpoint # active mountpoint
device.format.mountopts = options

0 comments on commit 8a7ac5a

Please sign in to comment.