ff33a1
From d8a8d96450bf0d3458671b9b7d23d972aa540396 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
---
ff33a1
 blivet/devicefactory.py                       | 24 +++----
ff33a1
 blivet/devices/dm.py                          |  9 ++-
ff33a1
 blivet/devices/loop.py                        | 20 +++---
ff33a1
 blivet/devices/luks.py                        | 26 ++++---
ff33a1
 blivet/errors.py                              |  2 +-
ff33a1
 blivet/partitioning.py                        | 22 +++++-
ff33a1
 blivet/populator/helpers/dm.py                |  4 +-
ff33a1
 blivet/populator/helpers/luks.py              |  4 +-
ff33a1
 blivet/populator/helpers/lvm.py               |  2 +-
ff33a1
 blivet/populator/helpers/mdraid.py            | 14 ++--
ff33a1
 blivet/populator/helpers/multipath.py         |  8 +--
ff33a1
 blivet/populator/populator.py                 | 67 ++++++++++---------
ff33a1
 blivet/threads.py                             |  3 +-
ff33a1
 blivet/udev.py                                | 34 +++++-----
ff33a1
 tests/unit_tests/devicefactory_test.py        | 10 +--
ff33a1
 .../devices_test/device_size_test.py          |  6 +-
ff33a1
 tests/unit_tests/populator_test.py            | 34 +++++-----
ff33a1
 tests/unit_tests/udev_test.py                 | 12 ++--
ff33a1
 tests/vmtests/vmbackedtestcase.py             |  2 +-
ff33a1
 19 files changed, 167 insertions(+), 136 deletions(-)
20511f
20511f
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py
ff33a1
index 6f460f6d..90082c28 100644
20511f
--- a/blivet/devicefactory.py
20511f
+++ b/blivet/devicefactory.py
ff33a1
@@ -859,12 +859,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:
ff33a1
@@ -1201,11 +1201,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
 
ff33a1
@@ -1227,10 +1227,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.
ff33a1
@@ -1290,7 +1290,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
ff33a1
index 2f936170..ae25e8e6 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
ff33a1
index 2eb1f130..5ab840ea 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
ff33a1
index b886ffec..30c9921a 100644
20511f
--- a/blivet/errors.py
20511f
+++ b/blivet/errors.py
ff33a1
@@ -201,7 +201,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
ff33a1
index ce77e4eb..2cd6554c 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
ff33a1
@@ -1635,7 +1635,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 = []
ff33a1
@@ -1673,7 +1681,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
ff33a1
index 4721390e..0ad065e2 100644
20511f
--- a/blivet/populator/helpers/dm.py
20511f
+++ b/blivet/populator/helpers/dm.py
ff33a1
@@ -47,13 +47,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
ff33a1
index 3221122a..9b5023f8 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)
ff33a1
         name = udev.device_get_name(self.data)
ff33a1
 
ff33a1
         try:
20511f
diff --git a/blivet/populator/helpers/lvm.py b/blivet/populator/helpers/lvm.py
ff33a1
index 6ef2f417..b549e8d3 100644
20511f
--- a/blivet/populator/helpers/lvm.py
20511f
+++ b/blivet/populator/helpers/lvm.py
ff33a1
@@ -58,7 +58,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
ff33a1
index a7602d20..9bec11ef 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
ff33a1
index 3a419418..068270b2 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
diff --git a/blivet/threads.py b/blivet/threads.py
ff33a1
index 5e2dff3f..1a5cc6db 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
ff33a1
index efbc53d6..ddc49a37 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
ff33a1
@@ -375,7 +375,7 @@ def device_is_disk(info):
20511f
                  device_is_dm_crypt(info) or
ff33a1
                  device_is_dm_stratis(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):
ff33a1
@@ -454,18 +454,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):
ff33a1
@@ -742,7 +742,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():
ff33a1
@@ -750,8 +750,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:
ff33a1
diff --git a/tests/unit_tests/devicefactory_test.py b/tests/unit_tests/devicefactory_test.py
ff33a1
index ff6bcb9e..552aadc1 100644
ff33a1
--- a/tests/unit_tests/devicefactory_test.py
ff33a1
+++ b/tests/unit_tests/devicefactory_test.py
ff33a1
@@ -115,9 +115,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"]))
ff33a1
@@ -357,7 +357,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
 
ff33a1
@@ -376,7 +376,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)
ff33a1
@@ -592,7 +592,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
 
ff33a1
diff --git a/tests/unit_tests/devices_test/device_size_test.py b/tests/unit_tests/devices_test/device_size_test.py
20511f
index d0c0a3f4..a1efa86d 100644
ff33a1
--- a/tests/unit_tests/devices_test/device_size_test.py
ff33a1
+++ b/tests/unit_tests/devices_test/device_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)
ff33a1
diff --git a/tests/unit_tests/populator_test.py b/tests/unit_tests/populator_test.py
ff33a1
index 369fe878..7ba04bac 100644
ff33a1
--- a/tests/unit_tests/populator_test.py
ff33a1
+++ b/tests/unit_tests/populator_test.py
ff33a1
@@ -86,7 +86,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):
ff33a1
@@ -95,7 +95,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()
ff33a1
         device.id = 0
ff33a1
@@ -106,7 +106,7 @@ class DMDevicePopulatorTestCase(PopulatorHelperTestCase):
20511f
         parent = Mock()
ff33a1
         parent.id = 0
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"
ff33a1
@@ -235,7 +235,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):
ff33a1
@@ -247,7 +247,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
 
ff33a1
@@ -267,7 +267,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)
ff33a1
@@ -639,7 +639,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")
ff33a1
@@ -650,7 +650,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 = []
ff33a1
@@ -713,12 +713,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
ff33a1
@@ -733,13 +733,13 @@ class MultipathDevicePopulatorTestCase(PopulatorHelperTestCase):
20511f
 
20511f
         device_name = "mpathtest"
20511f
         device_get_name.return_value = device_name
ff33a1
-        parent_1 = Mock(tags=set(), wwn=wwn[2:], id=0)
20511f
-        parent_1.parents = []
ff33a1
-        parent_2 = Mock(tags=set(), wwn=wwn[2:], id=0)
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]
ff33a1
+        slave_1 = Mock(tags=set(), wwn=wwn[2:], id=0)
20511f
+        slave_1.parents = []
ff33a1
+        slave_2 = Mock(tags=set(), wwn=wwn[2:], id=0)
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
 
ff33a1
diff --git a/tests/unit_tests/udev_test.py b/tests/unit_tests/udev_test.py
ff33a1
index b208efa8..ebcd59e2 100644
ff33a1
--- a/tests/unit_tests/udev_test.py
ff33a1
+++ b/tests/unit_tests/udev_test.py
ff33a1
@@ -49,11 +49,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')]
ff33a1
@@ -68,20 +68,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
-- 
ff33a1
2.38.1
20511f