-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
220 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,15 @@ | |
# Author(s): David Lehman <[email protected]> | ||
# | ||
|
||
import os | ||
|
||
import gi | ||
gi.require_version("BlockDev", "3.0") | ||
|
||
from gi.repository import BlockDev | ||
|
||
from . import raid | ||
from ..errors import BTRFSError | ||
from ..size import Size | ||
from ..tasks import availability | ||
|
||
|
@@ -45,3 +53,16 @@ | |
|
||
def is_btrfs_name_valid(name): | ||
return '\x00' not in name | ||
|
||
|
||
def get_mountpoint_subvolumes(mountpoint): | ||
""" Get list of subvolume names on given mounted btrfs filesystem | ||
""" | ||
if not os.path.ismount(mountpoint): | ||
raise ValueError("%s doesn't seem to be a mountpoint" % mountpoint) | ||
try: | ||
subvols = BlockDev.btrfs.list_subvolumes(mountpoint) | ||
except BlockDev.BtrfsError as e: | ||
raise BTRFSError(str(e)) | ||
else: | ||
return [s.path for s in subvols] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters