forked from storaged-project/blivet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for setting label when creating GFS2 format
Related: linux-system-roles/storage#418
- Loading branch information
1 parent
e23d354
commit 8ecb48f
Showing
7 changed files
with
52 additions
and
6 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
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,6 +20,7 @@ | |
# Red Hat Author(s): Anne Mulhern <[email protected]> | ||
|
||
import abc | ||
import string | ||
|
||
import gi | ||
gi.require_version("BlockDev", "3.0") | ||
|
@@ -92,3 +93,19 @@ class F2FSLabeling(FSLabeling): | |
@classmethod | ||
def label_format_ok(cls, label): | ||
return cls._blockdev_check_label("f2fs", label) | ||
|
||
|
||
class GFS2Labeling(FSLabeling): | ||
|
||
@classmethod | ||
def label_format_ok(cls, label): | ||
try: | ||
clustername, lockspace = label.split(":") | ||
except ValueError: | ||
return False | ||
|
||
if len(clustername) > 32 or len(lockspace) > 30: | ||
return False | ||
|
||
allowed = string.ascii_letters + string.digits + "-_" | ||
return all(c in allowed for c in clustername) and all(c in allowed for c in lockspace) |
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