Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.10-devel' into 3.10-release
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtechtrefny committed Jun 7, 2024
2 parents 0bfe9e5 + cccac96 commit a013290
Show file tree
Hide file tree
Showing 23 changed files with 451 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
CI_IMAGE: fedora:latest
CI_CONTAINER: blivet-tests
steps:
- name: Checkout libblockdev repository
- name: Checkout blivet repository
uses: actions/checkout@v4

- name: Install podman
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ tests/pylint/.pylint.d/
MANIFEST
misc/.vagrant
ChangeLog
.vscode
7 changes: 5 additions & 2 deletions blivet/arch.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,11 @@ def is_t2mac():
elif not os.path.isfile(DMI_PRODUCT_NAME):
t2_mac = False
else:
buf = read_file(DMI_PRODUCT_NAME).strip()
t2_mac = (buf in APPLE_T2_PRODUCT_NAMES)
try:
buf = read_file(DMI_PRODUCT_NAME).strip()
t2_mac = (buf in APPLE_T2_PRODUCT_NAMES)
except UnicodeDecodeError:
t2_mac = False
return t2_mac


Expand Down
2 changes: 1 addition & 1 deletion blivet/devicelibs/mdraid.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ def is_raid_level(cls, level):
hasattr(level, 'get_size')


raid_levels = MDRaidLevels(["raid0", "raid1", "raid4", "raid5", "raid6", "raid10", "linear"])
raid_levels = MDRaidLevels(["raid0", "raid1", "raid4", "raid5", "raid6", "raid10"])

EXTERNAL_DEPENDENCIES = [availability.BLOCKDEV_MDRAID_PLUGIN]
2 changes: 2 additions & 0 deletions blivet/devicelibs/stratis.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ def set_key(key_desc, passphrase, key_file):
fd = read
elif key_file:
fd = os.open(key_file, os.O_RDONLY)
else:
raise RuntimeError("Passphrase or key file must be provided")

fd_list = Gio.UnixFDList()
fd_list.append(fd)
Expand Down
4 changes: 2 additions & 2 deletions blivet/devices/btrfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from ..formats import get_format, DeviceFormat
from ..size import Size
from ..mounts import mounts_cache
from .. import missing_plugs
from .. import avail_plugs

import logging
log = logging.getLogger("blivet")
Expand Down Expand Up @@ -382,7 +382,7 @@ def _list_subvolumes(self, mountpoint, snapshots_only=False):
def list_subvolumes(self, snapshots_only=False):
subvols = []

if "btrfs" in missing_plugs:
if "btrfs" not in avail_plugs:
log.debug("not listing btrfs subvolumes, libblockdev btrfs plugin is missing")
return subvols

Expand Down
1 change: 1 addition & 0 deletions blivet/devicetree.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ def resolve_device(self, devspec, blkid_tab=None, crypt_tab=None, options=None,
break
elif options:
attr = None
val = None
if "subvol=" in options:
attr = "name"
val = util.get_option_value("subvol", options)
Expand Down
1 change: 1 addition & 0 deletions blivet/formats/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,7 @@ class GFS2(FS):
_check = True
_packages = ["gfs2-utils"]
_mkfs_class = fsmkfs.GFS2Mkfs
_labelfs = fslabeling.GFS2Labeling()
# FIXME parted needs to be thaught about btrfs so that we can set the
# partition table type correctly for btrfs partitions
# parted_system = fileSystemType["gfs2"]
Expand Down
2 changes: 2 additions & 0 deletions blivet/formats/luks.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ def add_passphrase(self, passphrase):
context = blockdev.CryptoKeyslotContext(passphrase=self.__passphrase)
elif self._key_file:
context = blockdev.CryptoKeyslotContext(keyfile=self._key_file)
else:
raise LUKSError("luks device not configured")

ncontext = blockdev.CryptoKeyslotContext(passphrase=passphrase)

Expand Down
2 changes: 1 addition & 1 deletion blivet/populator/helpers/disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def _get_kwargs(self):
kwargs["eui64"] = ninfo.eui64
kwargs["nguid"] = ninfo.nguid

if ninfo.uuid and ninfo.uuid != uuid.UUID(int=0):
if ninfo.uuid and str(ninfo.uuid) != str(uuid.UUID(int=0)):
kwargs["uuid"] = ninfo.uuid
else:
kwargs["uuid"] = None
Expand Down
2 changes: 2 additions & 0 deletions blivet/tasks/availability.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ def availability_errors(self, resource):
avail, _mode, utility = self.check_fn(self.fstype)
elif self.operation == FSOperation.MKFS:
avail, _options, utility = self.check_fn(self.fstype)
else:
raise RuntimeError("Unknown operation")
except blockdev.FSError as e:
return [str(e)]
if not avail:
Expand Down
17 changes: 17 additions & 0 deletions blivet/tasks/fslabeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

import abc
import string

import gi
gi.require_version("BlockDev", "3.0")
Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion blivet/tasks/fsmkfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def do_task(self, options=None, label=False, set_uuid=False, nodiscard=False):

class GFS2Mkfs(FSMkfs):
ext = availability.MKFS_GFS2_APP
label_option = None
label_option = "-t"
nodiscard_option = None
get_uuid_args = None

Expand Down
2 changes: 2 additions & 0 deletions blivet/udev.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ def get_device(sysfs_path=None, device_node=None):
device = pyudev.Devices.from_sys_path(global_udev, sysfs_path)
elif device_node is not None:
device = pyudev.Devices.from_device_file(global_udev, device_node)
else:
raise RuntimeError("At least one of 'sysfs_path' and 'device_node' must be specified")
except pyudev.DeviceNotFoundError as e:
log.error(e)
result = None
Expand Down
Loading

0 comments on commit a013290

Please sign in to comment.