[rhinstaller/blivet/pulls/69 master] Master multiple mounts
mulkieran
installerbot-noreply at redhat.com
Mon Apr 13 12:46:36 UTC 2015
> @@ -32,29 +32,42 @@ class MountsCache(object):
>
> def __init__(self):
> self.mountsHash = 0
> - self.mountpoints = {}
> + self.mountpoints = defaultdict(list)
>
> - def getMountpoint(self, devspec, subvolspec=None):
> - """ Get mountpoint for selected device
> + def getMountpoints(self, devspec, subvolspec=None):
> + """ Get mountpoints for selected device
>
> :param devscpec: device specification, eg. "/dev/vda1"
> :type devspec: str
> :param subvolspec: btrfs subvolume specification, eg. ID or name
> :type subvolspec: str
> - :returns: mountpoint (path)
> - :rtype: str or NoneType
> + :returns: list of mountpoints (path)
> + :rtype: list of str or empty list
>
> + .. note::
> + Devices can be mounted on multiple paths, and paths can have multiple
> + devices mounted to them (hiding previous mounts). Callers should take this into account.
> """
> + self._cacheCheck()
> +
> + return self.mountpoints[(devspec, subvolspec)]
> +
> + def isMountpoint(self, path):
> + """ Check to see if a path is already mounted
>
> + :param str path: Path to check
> + """
> self._cacheCheck()
>
> - return self.mountpoints.get((devspec, subvolspec))
> + return any(path in p for p in self.mountpoints.values())
>
> def _getActiveMounts(self):
> """ Get information about mounted devices from /proc/mounts and
> /proc/self/mountinfo
> - """
>
> + Refreshes self.mountpoints with current moutpoint information
> + """
> + self.mountpoints = defaultdict(list)
> for line in open("/proc/mounts").readlines():
> try:
> (devspec, mountpoint, fstype, _options, _rest) = line.split(None, 4)
If you could piggy-back another patch changing above line to:
```(devspec, mountpoint, fstype, _rest) = line.split(None, 3)```
that would be great.
--
To view this pull request on github, visit https://github.com/rhinstaller/blivet/pull/69#discussion_r28234603
More information about the anaconda-patches
mailing list