neil / rpms / python-blivet

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