def btrfs_get_mountpoints_of_subvol(subvol='', **kwargs):
"""
Determine the list of mountpoints for a given subvol (of the form @/foo/bar).
Returns a list of mountpoint(s), or an empty list.
"""
mountpoints = []
if not subvol:
return []
# Seems the easiest way to do this is to walk the disk partitions, extract the opts
# string and see if subvol is present. Remember the leading '/'.
for part in psutil.disk_partitions():
if "subvol=/{}".format(subvol) in part.opts:
mountpoints.append(part.mountpoint)
return mountpoints
# pylint: disable=unused-argument
评论列表
文章目录