neil / rpms / python-blivet

Forked from rpms/python-blivet a year ago
Clone
20511f
From 42042e7fb6177d3cfe5568e358a38278925a2624 Mon Sep 17 00:00:00 2001
20511f
From: Vojtech Trefny <vtrefny@redhat.com>
20511f
Date: Wed, 26 May 2021 12:27:34 +0200
20511f
Subject: [PATCH] Revert "Terminology cleanups"
20511f
20511f
This reverts following commits:
20511f
- 3d46339fe9cf12e9082fcbe4dc5acc9f92617e8d
20511f
- 63c9c7165e5cdfa4a47dcf0ed9d717b71e7921f2
20511f
- 8956b9af8a785ae25e0e7153d2ef0702ce2f567c
20511f
---
20511f
 blivet/devicefactory.py               | 24 +++++-----
20511f
 blivet/devices/dm.py                  |  9 +++-
20511f
 blivet/devices/loop.py                | 20 ++++----
20511f
 blivet/devices/luks.py                | 26 +++++-----
20511f
 blivet/errors.py                      |  2 +-
20511f
 blivet/partitioning.py                | 22 +++++++--
20511f
 blivet/populator/helpers/dm.py        |  4 +-
20511f
 blivet/populator/helpers/luks.py      |  4 +-
20511f
 blivet/populator/helpers/lvm.py       |  2 +-
20511f
 blivet/populator/helpers/mdraid.py    | 14 +++---
20511f
 blivet/populator/helpers/multipath.py |  8 ++--
20511f
 blivet/populator/populator.py         | 69 ++++++++++++++-------------
20511f
 blivet/threads.py                     |  3 +-
20511f
 blivet/udev.py                        | 34 ++++++-------
20511f
 tests/devicefactory_test.py           | 10 ++--
20511f
 tests/devices_test/size_test.py       |  6 +--
20511f
 tests/populator_test.py               | 34 ++++++-------
20511f
 tests/udev_test.py                    | 12 ++---
20511f
 tests/vmtests/vmbackedtestcase.py     |  2 +-
20511f
 19 files changed, 168 insertions(+), 137 deletions(-)
20511f
20511f
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py
20511f
index 0f7fdfa1..f56bd9a3 100644
20511f
--- a/blivet/devicefactory.py
20511f
+++ b/blivet/devicefactory.py
20511f
@@ -849,12 +849,12 @@ class DeviceFactory(object):
20511f
                 parent_container.parents.remove(orig_device)
20511f
 
20511f
         if self.encrypted and isinstance(self.device, LUKSDevice) and \
20511f
-                self.raw_device.format.luks_version != self.luks_version:
20511f
-            self.raw_device.format.luks_version = self.luks_version
20511f
+                self.device.slave.format.luks_version != self.luks_version:
20511f
+            self.device.slave.format.luks_version = self.luks_version
20511f
 
20511f
         if self.encrypted and isinstance(self.device, LUKSDevice) and \
20511f
-                self.raw_device.format.luks_sector_size != self.luks_sector_size:
20511f
-            self.raw_device.format.luks_sector_size = self.luks_sector_size
20511f
+                self.device.slave.format.luks_sector_size != self.luks_sector_size:
20511f
+            self.device.slave.format.luks_sector_size = self.luks_sector_size
20511f
 
20511f
     def _set_name(self):
20511f
         if not self.device_name:
20511f
@@ -1173,11 +1173,11 @@ class PartitionSetFactory(PartitionFactory):
20511f
                     container.parents.remove(member)
20511f
                 self.storage.destroy_device(member)
20511f
                 members.remove(member)
20511f
-                self.storage.format_device(member.raw_device,
20511f
+                self.storage.format_device(member.slave,
20511f
                                            get_format(self.fstype))
20511f
-                members.append(member.raw_device)
20511f
+                members.append(member.slave)
20511f
                 if container:
20511f
-                    container.parents.append(member.raw_device)
20511f
+                    container.parents.append(member.slave)
20511f
 
20511f
                 continue
20511f
 
20511f
@@ -1199,10 +1199,10 @@ class PartitionSetFactory(PartitionFactory):
20511f
 
20511f
                 continue
20511f
 
20511f
-            if member_encrypted and self.encrypted and self.luks_version != member.raw_device.format.luks_version:
20511f
-                member.raw_device.format.luks_version = self.luks_version
20511f
-            if member_encrypted and self.encrypted and self.luks_sector_size != member.raw_device.format.luks_sector_size:
20511f
-                member.raw_device.format.luks_sector_size = self.luks_sector_size
20511f
+            if member_encrypted and self.encrypted and self.luks_version != member.slave.format.luks_version:
20511f
+                member.slave.format.luks_version = self.luks_version
20511f
+            if member_encrypted and self.encrypted and self.luks_sector_size != member.slave.format.luks_sector_size:
20511f
+                member.slave.format.luks_sector_size = self.luks_sector_size
20511f
 
20511f
         ##
20511f
         # Prepare previously allocated member partitions for reallocation.
20511f
@@ -1262,7 +1262,7 @@ class PartitionSetFactory(PartitionFactory):
20511f
 
20511f
             if isinstance(member, LUKSDevice):
20511f
                 self.storage.destroy_device(member)
20511f
-                member = member.raw_device
20511f
+                member = member.slave
20511f
 
20511f
             self.storage.destroy_device(member)
20511f
 
20511f
diff --git a/blivet/devices/dm.py b/blivet/devices/dm.py
20511f
index 3529f61c..508a6f89 100644
20511f
--- a/blivet/devices/dm.py
20511f
+++ b/blivet/devices/dm.py
20511f
@@ -154,6 +154,11 @@ class DMDevice(StorageDevice):
20511f
         log_method_call(self, self.name, status=self.status)
20511f
         super(DMDevice, self)._set_name(value)
20511f
 
20511f
+    @property
20511f
+    def slave(self):
20511f
+        """ This device's backing device. """
20511f
+        return self.parents[0]
20511f
+
20511f
 
20511f
 class DMLinearDevice(DMDevice):
20511f
     _type = "dm-linear"
20511f
@@ -189,8 +194,8 @@ class DMLinearDevice(DMDevice):
20511f
         """ Open, or set up, a device. """
20511f
         log_method_call(self, self.name, orig=orig, status=self.status,
20511f
                         controllable=self.controllable)
20511f
-        parent_length = self.parents[0].current_size / LINUX_SECTOR_SIZE
20511f
-        blockdev.dm.create_linear(self.name, self.parents[0].path, parent_length,
20511f
+        slave_length = self.slave.current_size / LINUX_SECTOR_SIZE
20511f
+        blockdev.dm.create_linear(self.name, self.slave.path, slave_length,
20511f
                                   self.dm_uuid)
20511f
 
20511f
     def _post_setup(self):
20511f
diff --git a/blivet/devices/loop.py b/blivet/devices/loop.py
20511f
index 0f4d7775..78f88d7d 100644
20511f
--- a/blivet/devices/loop.py
20511f
+++ b/blivet/devices/loop.py
20511f
@@ -73,7 +73,7 @@ class LoopDevice(StorageDevice):
20511f
 
20511f
     def update_name(self):
20511f
         """ Update this device's name. """
20511f
-        if not self.parents[0].status:
20511f
+        if not self.slave.status:
20511f
             # if the backing device is inactive, so are we
20511f
             return self.name
20511f
 
20511f
@@ -81,7 +81,7 @@ class LoopDevice(StorageDevice):
20511f
             # if our name is loopN we must already be active
20511f
             return self.name
20511f
 
20511f
-        name = blockdev.loop.get_loop_name(self.parents[0].path)
20511f
+        name = blockdev.loop.get_loop_name(self.slave.path)
20511f
         if name.startswith("loop"):
20511f
             self.name = name
20511f
 
20511f
@@ -89,24 +89,24 @@ class LoopDevice(StorageDevice):
20511f
 
20511f
     @property
20511f
     def status(self):
20511f
-        return (self.parents[0].status and
20511f
+        return (self.slave.status and
20511f
                 self.name.startswith("loop") and
20511f
-                blockdev.loop.get_loop_name(self.parents[0].path) == self.name)
20511f
+                blockdev.loop.get_loop_name(self.slave.path) == self.name)
20511f
 
20511f
     @property
20511f
     def size(self):
20511f
-        return self.parents[0].size
20511f
+        return self.slave.size
20511f
 
20511f
     def _pre_setup(self, orig=False):
20511f
-        if not os.path.exists(self.parents[0].path):
20511f
-            raise errors.DeviceError("specified file (%s) does not exist" % self.parents[0].path)
20511f
+        if not os.path.exists(self.slave.path):
20511f
+            raise errors.DeviceError("specified file (%s) does not exist" % self.slave.path)
20511f
         return StorageDevice._pre_setup(self, orig=orig)
20511f
 
20511f
     def _setup(self, orig=False):
20511f
         """ Open, or set up, a device. """
20511f
         log_method_call(self, self.name, orig=orig, status=self.status,
20511f
                         controllable=self.controllable)
20511f
-        blockdev.loop.setup(self.parents[0].path)
20511f
+        blockdev.loop.setup(self.slave.path)
20511f
 
20511f
     def _post_setup(self):
20511f
         StorageDevice._post_setup(self)
20511f
@@ -123,3 +123,7 @@ class LoopDevice(StorageDevice):
20511f
         StorageDevice._post_teardown(self, recursive=recursive)
20511f
         self.name = "tmploop%d" % self.id
20511f
         self.sysfs_path = ''
20511f
+
20511f
+    @property
20511f
+    def slave(self):
20511f
+        return self.parents[0]
20511f
diff --git a/blivet/devices/luks.py b/blivet/devices/luks.py
20511f
index 5d6d6c65..555f1acd 100644
20511f
--- a/blivet/devices/luks.py
20511f
+++ b/blivet/devices/luks.py
20511f
@@ -66,13 +66,17 @@ class LUKSDevice(DMCryptDevice):
20511f
 
20511f
     @property
20511f
     def raw_device(self):
20511f
+        return self.slave
20511f
+
20511f
+    @property
20511f
+    def slave(self):
20511f
         if self._has_integrity:
20511f
             return self.parents[0].parents[0]
20511f
         return self.parents[0]
20511f
 
20511f
     def _get_size(self):
20511f
         if not self.exists:
20511f
-            size = self.raw_device.size - crypto.LUKS_METADATA_SIZE
20511f
+            size = self.slave.size - crypto.LUKS_METADATA_SIZE
20511f
         elif self.resizable and self.target_size != Size(0):
20511f
             size = self.target_size
20511f
         else:
20511f
@@ -80,8 +84,8 @@ class LUKSDevice(DMCryptDevice):
20511f
         return size
20511f
 
20511f
     def _set_size(self, newsize):
20511f
-        if not self.exists and not self.raw_device.exists:
20511f
-            self.raw_device.size = newsize + crypto.LUKS_METADATA_SIZE
20511f
+        if not self.exists and not self.slave.exists:
20511f
+            self.slave.size = newsize + crypto.LUKS_METADATA_SIZE
20511f
 
20511f
             # just run the StorageDevice._set_size to make sure we are in the format limits
20511f
             super(LUKSDevice, self)._set_size(newsize - crypto.LUKS_METADATA_SIZE)
20511f
@@ -108,22 +112,22 @@ class LUKSDevice(DMCryptDevice):
20511f
             raise ValueError("size is smaller than the minimum for this device")
20511f
 
20511f
         # don't allow larger luks than size (or target size) of backing device
20511f
-        if newsize > (self.raw_device.size - crypto.LUKS_METADATA_SIZE):
20511f
+        if newsize > (self.slave.size - crypto.LUKS_METADATA_SIZE):
20511f
             log.error("requested size %s is larger than size of the backing device %s",
20511f
-                      newsize, self.raw_device.size)
20511f
+                      newsize, self.slave.size)
20511f
             raise ValueError("size is larger than the size of the backing device")
20511f
 
20511f
         if self.align_target_size(newsize) != newsize:
20511f
             raise ValueError("new size would violate alignment requirements")
20511f
 
20511f
     def _get_target_size(self):
20511f
-        return self.raw_device.format.target_size
20511f
+        return self.slave.format.target_size
20511f
 
20511f
     @property
20511f
     def max_size(self):
20511f
         """ The maximum size this luks device can be. Maximum is based on the
20511f
             maximum size of the backing device. """
20511f
-        max_luks = self.raw_device.max_size - crypto.LUKS_METADATA_SIZE
20511f
+        max_luks = self.slave.max_size - crypto.LUKS_METADATA_SIZE
20511f
         max_format = self.format.max_size
20511f
         return min(max_luks, max_format) if max_format else max_luks
20511f
 
20511f
@@ -131,7 +135,7 @@ class LUKSDevice(DMCryptDevice):
20511f
     def resizable(self):
20511f
         """ Can this device be resized? """
20511f
         return (self._resizable and self.exists and self.format.resizable and
20511f
-                self.raw_device.resizable and not self._has_integrity)
20511f
+                self.slave.resizable and not self._has_integrity)
20511f
 
20511f
     def resize(self):
20511f
         # size of LUKSDevice depends on size of the LUKS format on backing
20511f
@@ -139,7 +143,7 @@ class LUKSDevice(DMCryptDevice):
20511f
         log_method_call(self, self.name, status=self.status)
20511f
 
20511f
     def _post_create(self):
20511f
-        self.name = self.raw_device.format.map_name
20511f
+        self.name = self.slave.format.map_name
20511f
         StorageDevice._post_create(self)
20511f
 
20511f
     def _post_teardown(self, recursive=False):
20511f
@@ -162,10 +166,10 @@ class LUKSDevice(DMCryptDevice):
20511f
             self.name = new_name
20511f
 
20511f
     def dracut_setup_args(self):
20511f
-        return set(["rd.luks.uuid=luks-%s" % self.raw_device.format.uuid])
20511f
+        return set(["rd.luks.uuid=luks-%s" % self.slave.format.uuid])
20511f
 
20511f
     def populate_ksdata(self, data):
20511f
-        self.raw_device.populate_ksdata(data)
20511f
+        self.slave.populate_ksdata(data)
20511f
         data.encrypted = True
20511f
         super(LUKSDevice, self).populate_ksdata(data)
20511f
 
20511f
diff --git a/blivet/errors.py b/blivet/errors.py
20511f
index fd51283f..f6bf853a 100644
20511f
--- a/blivet/errors.py
20511f
+++ b/blivet/errors.py
20511f
@@ -192,7 +192,7 @@ class DeviceTreeError(StorageError):
20511f
     pass
20511f
 
20511f
 
20511f
-class NoParentsError(DeviceTreeError):
20511f
+class NoSlavesError(DeviceTreeError):
20511f
     pass
20511f
 
20511f
 
20511f
diff --git a/blivet/partitioning.py b/blivet/partitioning.py
20511f
index 53f9cc3f..ca0a55d1 100644
20511f
--- a/blivet/partitioning.py
20511f
+++ b/blivet/partitioning.py
20511f
@@ -32,7 +32,7 @@ import _ped
20511f
 
20511f
 from .errors import DeviceError, PartitioningError, AlignmentError
20511f
 from .flags import flags
20511f
-from .devices import Device, PartitionDevice, device_path_to_name
20511f
+from .devices import Device, PartitionDevice, LUKSDevice, device_path_to_name
20511f
 from .size import Size
20511f
 from .i18n import _
20511f
 from .util import stringize, unicodeize, compare
20511f
@@ -1632,7 +1632,15 @@ class TotalSizeSet(object):
20511f
             :param size: the target combined size
20511f
             :type size: :class:`~.size.Size`
20511f
         """
20511f
-        self.devices = [d.raw_device for d in devices]
20511f
+        self.devices = []
20511f
+        for device in devices:
20511f
+            if isinstance(device, LUKSDevice):
20511f
+                partition = device.slave
20511f
+            else:
20511f
+                partition = device
20511f
+
20511f
+            self.devices.append(partition)
20511f
+
20511f
         self.size = size
20511f
 
20511f
         self.requests = []
20511f
@@ -1670,7 +1678,15 @@ class SameSizeSet(object):
20511f
             :keyword max_size: the maximum size for growable devices
20511f
             :type max_size: :class:`~.size.Size`
20511f
         """
20511f
-        self.devices = [d.raw_device for d in devices]
20511f
+        self.devices = []
20511f
+        for device in devices:
20511f
+            if isinstance(device, LUKSDevice):
20511f
+                partition = device.slave
20511f
+            else:
20511f
+                partition = device
20511f
+
20511f
+            self.devices.append(partition)
20511f
+
20511f
         self.size = size / len(devices)
20511f
         self.grow = grow
20511f
         self.max_size = max_size
20511f
diff --git a/blivet/populator/helpers/dm.py b/blivet/populator/helpers/dm.py
20511f
index 30e99aa1..770736b0 100644
20511f
--- a/blivet/populator/helpers/dm.py
20511f
+++ b/blivet/populator/helpers/dm.py
20511f
@@ -46,13 +46,13 @@ class DMDevicePopulator(DevicePopulator):
20511f
         name = udev.device_get_name(self.data)
20511f
         log_method_call(self, name=name)
20511f
         sysfs_path = udev.device_get_sysfs_path(self.data)
20511f
-        parent_devices = self._devicetree._add_parent_devices(self.data)
20511f
+        slave_devices = self._devicetree._add_slave_devices(self.data)
20511f
         device = self._devicetree.get_device_by_name(name)
20511f
 
20511f
         if device is None:
20511f
             device = DMDevice(name, dm_uuid=self.data.get('DM_UUID'),
20511f
                               sysfs_path=sysfs_path, exists=True,
20511f
-                              parents=[parent_devices[0]])
20511f
+                              parents=[slave_devices[0]])
20511f
             device.protected = True
20511f
             device.controllable = False
20511f
             self._devicetree._add_device(device)
20511f
diff --git a/blivet/populator/helpers/luks.py b/blivet/populator/helpers/luks.py
20511f
index 52795a98..51488691 100644
20511f
--- a/blivet/populator/helpers/luks.py
20511f
+++ b/blivet/populator/helpers/luks.py
20511f
@@ -43,7 +43,7 @@ class LUKSDevicePopulator(DevicePopulator):
20511f
         return udev.device_is_dm_luks(data)
20511f
 
20511f
     def run(self):
20511f
-        parents = self._devicetree._add_parent_devices(self.data)
20511f
+        parents = self._devicetree._add_slave_devices(self.data)
20511f
         device = LUKSDevice(udev.device_get_name(self.data),
20511f
                             sysfs_path=udev.device_get_sysfs_path(self.data),
20511f
                             parents=parents,
20511f
@@ -58,7 +58,7 @@ class IntegrityDevicePopulator(DevicePopulator):
20511f
         return udev.device_is_dm_integrity(data)
20511f
 
20511f
     def run(self):
20511f
-        parents = self._devicetree._add_parent_devices(self.data)
20511f
+        parents = self._devicetree._add_slave_devices(self.data)
20511f
         device = IntegrityDevice(udev.device_get_name(self.data),
20511f
                                  sysfs_path=udev.device_get_sysfs_path(self.data),
20511f
                                  parents=parents,
20511f
diff --git a/blivet/populator/helpers/lvm.py b/blivet/populator/helpers/lvm.py
20511f
index c7adfa4e..b1626306 100644
20511f
--- a/blivet/populator/helpers/lvm.py
20511f
+++ b/blivet/populator/helpers/lvm.py
20511f
@@ -57,7 +57,7 @@ class LVMDevicePopulator(DevicePopulator):
20511f
             log.warning("found non-vg device with name %s", vg_name)
20511f
             device = None
20511f
 
20511f
-        self._devicetree._add_parent_devices(self.data)
20511f
+        self._devicetree._add_slave_devices(self.data)
20511f
 
20511f
         # LVM provides no means to resolve conflicts caused by duplicated VG
20511f
         # names, so we're just being optimistic here. Woo!
20511f
diff --git a/blivet/populator/helpers/mdraid.py b/blivet/populator/helpers/mdraid.py
20511f
index 3479e3f7..76aebf25 100644
20511f
--- a/blivet/populator/helpers/mdraid.py
20511f
+++ b/blivet/populator/helpers/mdraid.py
20511f
@@ -31,7 +31,7 @@ from ... import udev
20511f
 from ...devicelibs import raid
20511f
 from ...devices import MDRaidArrayDevice, MDContainerDevice
20511f
 from ...devices import device_path_to_name
20511f
-from ...errors import DeviceError, NoParentsError
20511f
+from ...errors import DeviceError, NoSlavesError
20511f
 from ...flags import flags
20511f
 from ...storage_log import log_method_call
20511f
 from .devicepopulator import DevicePopulator
20511f
@@ -52,12 +52,12 @@ class MDDevicePopulator(DevicePopulator):
20511f
         log_method_call(self, name=name)
20511f
 
20511f
         try:
20511f
-            self._devicetree._add_parent_devices(self.data)
20511f
-        except NoParentsError:
20511f
-            log.error("no parents found for mdarray %s, skipping", name)
20511f
+            self._devicetree._add_slave_devices(self.data)
20511f
+        except NoSlavesError:
20511f
+            log.error("no slaves found for mdarray %s, skipping", name)
20511f
             return None
20511f
 
20511f
-        # try to get the device again now that we've got all the parents
20511f
+        # try to get the device again now that we've got all the slaves
20511f
         device = self._devicetree.get_device_by_name(name, incomplete=flags.allow_imperfect_devices)
20511f
 
20511f
         if device is None:
20511f
@@ -74,8 +74,8 @@ class MDDevicePopulator(DevicePopulator):
20511f
             device.name = name
20511f
 
20511f
         if device is None:
20511f
-            # if we get here, we found all of the parent devices and
20511f
-            # something must be wrong -- if all of the parents are in
20511f
+            # if we get here, we found all of the slave devices and
20511f
+            # something must be wrong -- if all of the slaves are in
20511f
             # the tree, this device should be as well
20511f
             if name is None:
20511f
                 name = udev.device_get_name(self.data)
20511f
diff --git a/blivet/populator/helpers/multipath.py b/blivet/populator/helpers/multipath.py
20511f
index 96c0a9ad..10c745bf 100644
20511f
--- a/blivet/populator/helpers/multipath.py
20511f
+++ b/blivet/populator/helpers/multipath.py
20511f
@@ -40,13 +40,13 @@ class MultipathDevicePopulator(DevicePopulator):
20511f
         name = udev.device_get_name(self.data)
20511f
         log_method_call(self, name=name)
20511f
 
20511f
-        parent_devices = self._devicetree._add_parent_devices(self.data)
20511f
+        slave_devices = self._devicetree._add_slave_devices(self.data)
20511f
 
20511f
         device = None
20511f
-        if parent_devices:
20511f
-            device = MultipathDevice(name, parents=parent_devices,
20511f
+        if slave_devices:
20511f
+            device = MultipathDevice(name, parents=slave_devices,
20511f
                                      sysfs_path=udev.device_get_sysfs_path(self.data),
20511f
-                                     wwn=parent_devices[0].wwn)
20511f
+                                     wwn=slave_devices[0].wwn)
20511f
             self._devicetree._add_device(device)
20511f
 
20511f
         return device
20511f
diff --git a/blivet/populator/populator.py b/blivet/populator/populator.py
20511f
index 75bb1741..d252281d 100644
20511f
--- a/blivet/populator/populator.py
20511f
+++ b/blivet/populator/populator.py
20511f
@@ -31,7 +31,7 @@ gi.require_version("BlockDev", "2.0")
20511f
 
20511f
 from gi.repository import BlockDev as blockdev
20511f
 
20511f
-from ..errors import DeviceError, DeviceTreeError, NoParentsError
20511f
+from ..errors import DeviceError, DeviceTreeError, NoSlavesError
20511f
 from ..devices import DMLinearDevice, DMRaidArrayDevice
20511f
 from ..devices import FileDevice, LoopDevice
20511f
 from ..devices import MDRaidArrayDevice
20511f
@@ -92,55 +92,56 @@ class PopulatorMixin(object):
20511f
 
20511f
         self._cleanup = False
20511f
 
20511f
-    def _add_parent_devices(self, info):
20511f
-        """ Add all parents of a device, raising DeviceTreeError on failure.
20511f
+    def _add_slave_devices(self, info):
20511f
+        """ Add all slaves of a device, raising DeviceTreeError on failure.
20511f
 
20511f
             :param :class:`pyudev.Device` info: the device's udev info
20511f
-            :raises: :class:`~.errors.DeviceTreeError if no parents are found or
20511f
-                     if we fail to add any parent
20511f
-            :returns: a list of parent devices
20511f
+            :raises: :class:`~.errors.DeviceTreeError if no slaves are found or
20511f
+                     if we fail to add any slave
20511f
+            :returns: a list of slave devices
20511f
             :rtype: list of :class:`~.StorageDevice`
20511f
         """
20511f
         name = udev.device_get_name(info)
20511f
         sysfs_path = udev.device_get_sysfs_path(info)
20511f
-        parent_dir = os.path.normpath("%s/slaves" % sysfs_path)
20511f
-        parent_names = os.listdir(parent_dir)
20511f
-        parent_devices = []
20511f
-        if not parent_names:
20511f
-            log.error("no parents found for %s", name)
20511f
-            raise NoParentsError("no parents found for device %s" % name)
20511f
-
20511f
-        for parent_name in parent_names:
20511f
-            path = os.path.normpath("%s/%s" % (parent_dir, parent_name))
20511f
-            parent_info = udev.get_device(os.path.realpath(path))
20511f
-
20511f
-            if not parent_info:
20511f
-                msg = "unable to get udev info for %s" % parent_name
20511f
+        slave_dir = os.path.normpath("%s/slaves" % sysfs_path)
20511f
+        slave_names = os.listdir(slave_dir)
20511f
+        slave_devices = []
20511f
+        if not slave_names:
20511f
+            log.error("no slaves found for %s", name)
20511f
+            raise NoSlavesError("no slaves found for device %s" % name)
20511f
+
20511f
+        for slave_name in slave_names:
20511f
+            path = os.path.normpath("%s/%s" % (slave_dir, slave_name))
20511f
+            slave_info = udev.get_device(os.path.realpath(path))
20511f
+
20511f
+            if not slave_info:
20511f
+                msg = "unable to get udev info for %s" % slave_name
20511f
                 raise DeviceTreeError(msg)
20511f
 
20511f
             # cciss in sysfs is "cciss!cXdYpZ" but we need "cciss/cXdYpZ"
20511f
-            parent_name = udev.device_get_name(parent_info).replace("!", "/")
20511f
-
20511f
-            parent_dev = self.get_device_by_name(parent_name)
20511f
-            if not parent_dev and parent_info:
20511f
-                # we haven't scanned the parent yet, so do it now
20511f
-                self.handle_device(parent_info)
20511f
-                parent_dev = self.get_device_by_name(parent_name)
20511f
-                if parent_dev is None:
20511f
+            slave_name = udev.device_get_name(slave_info).replace("!", "/")
20511f
+
20511f
+            slave_dev = self.get_device_by_name(slave_name)
20511f
+            if not slave_dev and slave_info:
20511f
+                # we haven't scanned the slave yet, so do it now
20511f
+                self.handle_device(slave_info)
20511f
+                slave_dev = self.get_device_by_name(slave_name)
20511f
+                if slave_dev is None:
20511f
                     if udev.device_is_dm_lvm(info):
20511f
-                        if parent_name not in lvs_info.cache:
20511f
+                        if slave_name not in lvs_info.cache:
20511f
                             # we do not expect hidden lvs to be in the tree
20511f
                             continue
20511f
 
20511f
-                    # if the current parent is still not in
20511f
+                    # if the current slave is still not in
20511f
                     # the tree, something has gone wrong
20511f
-                    log.error("failure scanning device %s: could not add parent %s", name, parent_name)
20511f
-                    msg = "failed to add parent %s of device %s" % (parent_name, name)
20511f
+                    log.error("failure scanning device %s: could not add slave %s", name, slave_name)
20511f
+                    msg = "failed to add slave %s of device %s" % (slave_name,
20511f
+                                                                   name)
20511f
                     raise DeviceTreeError(msg)
20511f
 
20511f
-            parent_devices.append(parent_dev)
20511f
+            slave_devices.append(slave_dev)
20511f
 
20511f
-        return parent_devices
20511f
+        return slave_devices
20511f
 
20511f
     def _add_name(self, name):
20511f
         if name not in self.names:
20511f
@@ -317,7 +318,7 @@ class PopulatorMixin(object):
20511f
                 continue
20511f
 
20511f
             # Make sure lvm doesn't get confused by PVs that belong to
20511f
-            # incomplete VGs. We will remove the PVs from the reject list when/if
20511f
+            # incomplete VGs. We will remove the PVs from the blacklist when/if
20511f
             # the time comes to remove the incomplete VG and its PVs.
20511f
             for pv in vg.pvs:
20511f
                 lvm.lvm_cc_addFilterRejectRegexp(pv.name)
20511f
diff --git a/blivet/threads.py b/blivet/threads.py
20511f
index 7e6d3105..a70deb69 100644
20511f
--- a/blivet/threads.py
20511f
+++ b/blivet/threads.py
20511f
@@ -63,11 +63,12 @@ class SynchronizedMeta(type):
20511f
     """
20511f
     def __new__(cls, name, bases, dct):
20511f
         new_dct = {}
20511f
+        blacklist = dct.get('_unsynchronized_methods', [])
20511f
 
20511f
         for n in dct:
20511f
             obj = dct[n]
20511f
             # Do not decorate class or static methods.
20511f
-            if n in dct.get('_unsynchronized_methods', []):
20511f
+            if n in blacklist:
20511f
                 pass
20511f
             elif isinstance(obj, FunctionType):
20511f
                 obj = exclusive(obj)
20511f
diff --git a/blivet/udev.py b/blivet/udev.py
20511f
index a8297f3f..e1b67845 100644
20511f
--- a/blivet/udev.py
20511f
+++ b/blivet/udev.py
20511f
@@ -39,7 +39,7 @@ from gi.repository import BlockDev as blockdev
20511f
 global_udev = pyudev.Context()
20511f
 log = logging.getLogger("blivet")
20511f
 
20511f
-ignored_device_names = []
20511f
+device_name_blacklist = []
20511f
 """ device name regexes to ignore; this should be empty by default """
20511f
 
20511f
 
20511f
@@ -77,7 +77,7 @@ def get_devices(subsystem="block"):
20511f
 
20511f
     result = []
20511f
     for device in global_udev.list_devices(subsystem=subsystem):
20511f
-        if not __is_ignored_blockdev(device.sys_name):
20511f
+        if not __is_blacklisted_blockdev(device.sys_name):
20511f
             dev = device_to_dict(device)
20511f
             result.append(dev)
20511f
 
20511f
@@ -176,13 +176,13 @@ def resolve_glob(glob):
20511f
     return ret
20511f
 
20511f
 
20511f
-def __is_ignored_blockdev(dev_name):
20511f
+def __is_blacklisted_blockdev(dev_name):
20511f
     """Is this a blockdev we never want for an install?"""
20511f
     if dev_name.startswith("ram") or dev_name.startswith("fd"):
20511f
         return True
20511f
 
20511f
-    if ignored_device_names:
20511f
-        if any(re.search(expr, dev_name) for expr in ignored_device_names):
20511f
+    if device_name_blacklist:
20511f
+        if any(re.search(expr, dev_name) for expr in device_name_blacklist):
20511f
             return True
20511f
 
20511f
     dev_path = "/sys/class/block/%s" % dev_name
20511f
@@ -374,7 +374,7 @@ def device_is_disk(info):
20511f
                  device_is_dm_lvm(info) or
20511f
                  device_is_dm_crypt(info) or
20511f
                  (device_is_md(info) and
20511f
-                  (not device_get_md_container(info) and not all(device_is_disk(d) for d in device_get_parents(info))))))
20511f
+                  (not device_get_md_container(info) and not all(device_is_disk(d) for d in device_get_slaves(info))))))
20511f
 
20511f
 
20511f
 def device_is_partition(info):
20511f
@@ -453,18 +453,18 @@ def device_get_devname(info):
20511f
     return info.get('DEVNAME')
20511f
 
20511f
 
20511f
-def device_get_parents(info):
20511f
-    """ Return a list of udev device objects representing this device's parents. """
20511f
-    parents_dir = device_get_sysfs_path(info) + "/slaves/"
20511f
+def device_get_slaves(info):
20511f
+    """ Return a list of udev device objects representing this device's slaves. """
20511f
+    slaves_dir = device_get_sysfs_path(info) + "/slaves/"
20511f
     names = list()
20511f
-    if os.path.isdir(parents_dir):
20511f
-        names = os.listdir(parents_dir)
20511f
+    if os.path.isdir(slaves_dir):
20511f
+        names = os.listdir(slaves_dir)
20511f
 
20511f
-    parents = list()
20511f
+    slaves = list()
20511f
     for name in names:
20511f
-        parents.append(get_device(device_node="/dev/" + name))
20511f
+        slaves.append(get_device(device_node="/dev/" + name))
20511f
 
20511f
-    return parents
20511f
+    return slaves
20511f
 
20511f
 
20511f
 def device_get_holders(info):
20511f
@@ -736,7 +736,7 @@ def device_get_partition_disk(info):
20511f
     disk = None
20511f
     majorminor = info.get("ID_PART_ENTRY_DISK")
20511f
     sysfs_path = device_get_sysfs_path(info)
20511f
-    parents_dir = "%s/slaves" % sysfs_path
20511f
+    slaves_dir = "%s/slaves" % sysfs_path
20511f
     if majorminor:
20511f
         major, minor = majorminor.split(":")
20511f
         for device in get_devices():
20511f
@@ -744,8 +744,8 @@ def device_get_partition_disk(info):
20511f
                 disk = device_get_name(device)
20511f
                 break
20511f
     elif device_is_dm_partition(info):
20511f
-        if os.path.isdir(parents_dir):
20511f
-            parents = os.listdir(parents_dir)
20511f
+        if os.path.isdir(slaves_dir):
20511f
+            parents = os.listdir(slaves_dir)
20511f
             if len(parents) == 1:
20511f
                 disk = resolve_devspec(parents[0].replace('!', '/'))
20511f
     else:
20511f
diff --git a/tests/devicefactory_test.py b/tests/devicefactory_test.py
20511f
index dc0d6408..dfd78a7a 100644
20511f
--- a/tests/devicefactory_test.py
20511f
+++ b/tests/devicefactory_test.py
20511f
@@ -112,9 +112,9 @@ class DeviceFactoryTestCase(unittest.TestCase):
20511f
                          kwargs.get("encrypted", False) or
20511f
                          kwargs.get("container_encrypted", False))
20511f
         if kwargs.get("encrypted", False):
20511f
-            self.assertEqual(device.parents[0].format.luks_version,
20511f
+            self.assertEqual(device.slave.format.luks_version,
20511f
                              kwargs.get("luks_version", crypto.DEFAULT_LUKS_VERSION))
20511f
-            self.assertEqual(device.raw_device.format.luks_sector_size,
20511f
+            self.assertEqual(device.slave.format.luks_sector_size,
20511f
                              kwargs.get("luks_sector_size", 0))
20511f
 
20511f
         self.assertTrue(set(device.disks).issubset(kwargs["disks"]))
20511f
@@ -354,7 +354,7 @@ class LVMFactoryTestCase(DeviceFactoryTestCase):
20511f
         device = args[0]
20511f
 
20511f
         if kwargs.get("encrypted"):
20511f
-            container = device.parents[0].container
20511f
+            container = device.slave.container
20511f
         else:
20511f
             container = device.container
20511f
 
20511f
@@ -373,7 +373,7 @@ class LVMFactoryTestCase(DeviceFactoryTestCase):
20511f
             self.assertIsInstance(pv, member_class)
20511f
 
20511f
             if pv.encrypted:
20511f
-                self.assertEqual(pv.parents[0].format.luks_version,
20511f
+                self.assertEqual(pv.slave.format.luks_version,
20511f
                                  kwargs.get("luks_version", crypto.DEFAULT_LUKS_VERSION))
20511f
 
20511f
     @patch("blivet.formats.lvmpv.LVMPhysicalVolume.formattable", return_value=True)
20511f
@@ -589,7 +589,7 @@ class LVMThinPFactoryTestCase(LVMFactoryTestCase):
20511f
         device = args[0]
20511f
 
20511f
         if kwargs.get("encrypted", False):
20511f
-            thinlv = device.parents[0]
20511f
+            thinlv = device.slave
20511f
         else:
20511f
             thinlv = device
20511f
 
20511f
diff --git a/tests/devices_test/size_test.py b/tests/devices_test/size_test.py
20511f
index d0c0a3f4..a1efa86d 100644
20511f
--- a/tests/devices_test/size_test.py
20511f
+++ b/tests/devices_test/size_test.py
20511f
@@ -107,8 +107,8 @@ class LUKSDeviceSizeTest(StorageDeviceSizeTest):
20511f
 
20511f
     def _get_device(self, *args, **kwargs):
20511f
         exists = kwargs.get("exists", False)
20511f
-        parent = StorageDevice(*args, size=kwargs["size"] + crypto.LUKS_METADATA_SIZE, exists=exists)
20511f
-        return LUKSDevice(*args, **kwargs, parents=[parent])
20511f
+        slave = StorageDevice(*args, size=kwargs["size"] + crypto.LUKS_METADATA_SIZE, exists=exists)
20511f
+        return LUKSDevice(*args, **kwargs, parents=[slave])
20511f
 
20511f
     def test_size_getter(self):
20511f
         initial_size = Size("10 GiB")
20511f
@@ -116,4 +116,4 @@ class LUKSDeviceSizeTest(StorageDeviceSizeTest):
20511f
 
20511f
         # for LUKS size depends on the backing device size
20511f
         self.assertEqual(dev.size, initial_size)
20511f
-        self.assertEqual(dev.raw_device.size, initial_size + crypto.LUKS_METADATA_SIZE)
20511f
+        self.assertEqual(dev.slave.size, initial_size + crypto.LUKS_METADATA_SIZE)
20511f
diff --git a/tests/populator_test.py b/tests/populator_test.py
20511f
index a7748a9d..531ec74b 100644
20511f
--- a/tests/populator_test.py
20511f
+++ b/tests/populator_test.py
20511f
@@ -81,7 +81,7 @@ class DMDevicePopulatorTestCase(PopulatorHelperTestCase):
20511f
     @patch.object(DeviceTree, "get_device_by_name")
20511f
     @patch.object(DMDevice, "status", return_value=True)
20511f
     @patch.object(DMDevice, "update_sysfs_path")
20511f
-    @patch.object(DeviceTree, "_add_parent_devices")
20511f
+    @patch.object(DeviceTree, "_add_slave_devices")
20511f
     @patch("blivet.udev.device_get_name")
20511f
     @patch("blivet.udev.device_get_sysfs_path", return_value=sentinel.sysfs_path)
20511f
     def test_run(self, *args):
20511f
@@ -90,7 +90,7 @@ class DMDevicePopulatorTestCase(PopulatorHelperTestCase):
20511f
 
20511f
         devicetree = DeviceTree()
20511f
 
20511f
-        # The general case for dm devices is that adding the parent devices
20511f
+        # The general case for dm devices is that adding the slave/parent devices
20511f
         # will result in the dm device itself being in the tree.
20511f
         device = Mock()
20511f
         devicetree.get_device_by_name.return_value = device
20511f
@@ -99,7 +99,7 @@ class DMDevicePopulatorTestCase(PopulatorHelperTestCase):
20511f
 
20511f
         parent = Mock()
20511f
         parent.parents = []
20511f
-        devicetree._add_parent_devices.return_value = [parent]
20511f
+        devicetree._add_slave_devices.return_value = [parent]
20511f
         devicetree._add_device(parent)
20511f
         devicetree.get_device_by_name.return_value = None
20511f
         device_name = "dmdevice"
20511f
@@ -228,7 +228,7 @@ class LVMDevicePopulatorTestCase(PopulatorHelperTestCase):
20511f
         # could be the first helper class checked.
20511f
 
20511f
     @patch.object(DeviceTree, "get_device_by_name")
20511f
-    @patch.object(DeviceTree, "_add_parent_devices")
20511f
+    @patch.object(DeviceTree, "_add_slave_devices")
20511f
     @patch("blivet.udev.device_get_name")
20511f
     @patch("blivet.udev.device_get_lv_vg_name")
20511f
     def test_run(self, *args):
20511f
@@ -240,7 +240,7 @@ class LVMDevicePopulatorTestCase(PopulatorHelperTestCase):
20511f
         devicetree = DeviceTree()
20511f
         data = Mock()
20511f
 
20511f
-        # Add parent devices and then look up the device.
20511f
+        # Add slave/parent devices and then look up the device.
20511f
         device_get_name.return_value = sentinel.lv_name
20511f
         devicetree.get_device_by_name.return_value = None
20511f
 
20511f
@@ -260,7 +260,7 @@ class LVMDevicePopulatorTestCase(PopulatorHelperTestCase):
20511f
              call(sentinel.vg_name),
20511f
              call(sentinel.lv_name)])
20511f
 
20511f
-        # Add parent devices, but the device is still not in the tree
20511f
+        # Add slave/parent devices, but the device is still not in the tree
20511f
         get_device_by_name.side_effect = None
20511f
         get_device_by_name.return_value = None
20511f
         self.assertEqual(helper.run(), None)
20511f
@@ -625,7 +625,7 @@ class MDDevicePopulatorTestCase(PopulatorHelperTestCase):
20511f
         # could be the first helper class checked.
20511f
 
20511f
     @patch.object(DeviceTree, "get_device_by_name")
20511f
-    @patch.object(DeviceTree, "_add_parent_devices")
20511f
+    @patch.object(DeviceTree, "_add_slave_devices")
20511f
     @patch("blivet.udev.device_get_name")
20511f
     @patch("blivet.udev.device_get_md_uuid")
20511f
     @patch("blivet.udev.device_get_md_name")
20511f
@@ -636,7 +636,7 @@ class MDDevicePopulatorTestCase(PopulatorHelperTestCase):
20511f
 
20511f
         devicetree = DeviceTree()
20511f
 
20511f
-        # base case: _add_parent_devices gets the array into the tree
20511f
+        # base case: _add_slave_devices gets the array into the tree
20511f
         data = Mock()
20511f
         device = Mock()
20511f
         device.parents = []
20511f
@@ -699,12 +699,12 @@ class MultipathDevicePopulatorTestCase(PopulatorHelperTestCase):
20511f
         # could be the first helper class checked.
20511f
 
20511f
     @patch("blivet.udev.device_get_sysfs_path")
20511f
-    @patch.object(DeviceTree, "_add_parent_devices")
20511f
+    @patch.object(DeviceTree, "_add_slave_devices")
20511f
     @patch("blivet.udev.device_get_name")
20511f
     def test_run(self, *args):
20511f
         """Test multipath device populator."""
20511f
         device_get_name = args[0]
20511f
-        add_parent_devices = args[1]
20511f
+        add_slave_devices = args[1]
20511f
 
20511f
         devicetree = DeviceTree()
20511f
         # set up some fake udev data to verify handling of specific entries
20511f
@@ -719,13 +719,13 @@ class MultipathDevicePopulatorTestCase(PopulatorHelperTestCase):
20511f
 
20511f
         device_name = "mpathtest"
20511f
         device_get_name.return_value = device_name
20511f
-        parent_1 = Mock(tags=set(), wwn=wwn[2:])
20511f
-        parent_1.parents = []
20511f
-        parent_2 = Mock(tags=set(), wwn=wwn[2:])
20511f
-        parent_2.parents = []
20511f
-        devicetree._add_device(parent_1)
20511f
-        devicetree._add_device(parent_2)
20511f
-        add_parent_devices.return_value = [parent_1, parent_2]
20511f
+        slave_1 = Mock(tags=set(), wwn=wwn[2:])
20511f
+        slave_1.parents = []
20511f
+        slave_2 = Mock(tags=set(), wwn=wwn[2:])
20511f
+        slave_2.parents = []
20511f
+        devicetree._add_device(slave_1)
20511f
+        devicetree._add_device(slave_2)
20511f
+        add_slave_devices.return_value = [slave_1, slave_2]
20511f
 
20511f
         helper = self.helper_class(devicetree, data)
20511f
 
20511f
diff --git a/tests/udev_test.py b/tests/udev_test.py
20511f
index f9b10620..d30a647b 100644
20511f
--- a/tests/udev_test.py
20511f
+++ b/tests/udev_test.py
20511f
@@ -45,11 +45,11 @@ class UdevTest(unittest.TestCase):
20511f
     @mock.patch('blivet.udev.device_is_dm_crypt', return_value=False)
20511f
     @mock.patch('blivet.udev.device_is_md')
20511f
     @mock.patch('blivet.udev.device_get_md_container')
20511f
-    @mock.patch('blivet.udev.device_get_parents')
20511f
+    @mock.patch('blivet.udev.device_get_slaves')
20511f
     def test_udev_device_is_disk_md(self, *args):
20511f
         import blivet.udev
20511f
         info = dict(DEVTYPE='disk', SYS_PATH=mock.sentinel.md_path)
20511f
-        (device_get_parents, device_get_md_container, device_is_md) = args[:3]  # pylint: disable=unbalanced-tuple-unpacking
20511f
+        (device_get_slaves, device_get_md_container, device_is_md) = args[:3]  # pylint: disable=unbalanced-tuple-unpacking
20511f
 
20511f
         disk_parents = [dict(DEVTYPE="disk", SYS_PATH='/fake/path/2'),
20511f
                         dict(DEVTYPE="disk", SYS_PATH='/fake/path/3')]
20511f
@@ -64,20 +64,20 @@ class UdevTest(unittest.TestCase):
20511f
         # Intel FW RAID (MD RAID w/ container layer)
20511f
         # device_get_container will return some mock value which will evaluate to True
20511f
         device_get_md_container.return_value = mock.sentinel.md_container
20511f
-        device_get_parents.side_effect = lambda info: list()
20511f
+        device_get_slaves.side_effect = lambda info: list()
20511f
         self.assertTrue(blivet.udev.device_is_disk(info))
20511f
 
20511f
         # Normal MD RAID
20511f
-        device_get_parents.side_effect = lambda info: partition_parents if info['SYS_PATH'] == mock.sentinel.md_path else list()
20511f
+        device_get_slaves.side_effect = lambda info: partition_parents if info['SYS_PATH'] == mock.sentinel.md_path else list()
20511f
         device_get_md_container.return_value = None
20511f
         self.assertFalse(blivet.udev.device_is_disk(info))
20511f
 
20511f
         # Dell FW RAID (MD RAID whose members are all whole disks)
20511f
-        device_get_parents.side_effect = lambda info: disk_parents if info['SYS_PATH'] == mock.sentinel.md_path else list()
20511f
+        device_get_slaves.side_effect = lambda info: disk_parents if info['SYS_PATH'] == mock.sentinel.md_path else list()
20511f
         self.assertTrue(blivet.udev.device_is_disk(info))
20511f
 
20511f
         # Normal MD RAID (w/ at least one non-disk member)
20511f
-        device_get_parents.side_effect = lambda info: mixed_parents if info['SYS_PATH'] == mock.sentinel.md_path else list()
20511f
+        device_get_slaves.side_effect = lambda info: mixed_parents if info['SYS_PATH'] == mock.sentinel.md_path else list()
20511f
         self.assertFalse(blivet.udev.device_is_disk(info))
20511f
 
20511f
 
20511f
diff --git a/tests/vmtests/vmbackedtestcase.py b/tests/vmtests/vmbackedtestcase.py
20511f
index 797bac85..6255104f 100644
20511f
--- a/tests/vmtests/vmbackedtestcase.py
20511f
+++ b/tests/vmtests/vmbackedtestcase.py
20511f
@@ -50,7 +50,7 @@ class VMBackedTestCase(unittest.TestCase):
20511f
             defined in set_up_disks.
20511f
         """
20511f
 
20511f
-        udev.ignored_device_names = [r'^zram']
20511f
+        udev.device_name_blacklist = [r'^zram']
20511f
 
20511f
         #
20511f
         # create disk images
20511f
-- 
20511f
2.31.1
20511f