neil / rpms / python-blivet

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