[PATCH 01/13] Replace our pyudev with the package python-pyudev.
Vratislav Podzimek
vpodzime at redhat.com
Mon Jun 1 07:40:18 UTC 2015
On Wed, 2015-05-27 at 13:16 -0500, David Lehman wrote:
> There are two major differences in how we use the module. Each device
> is represented by a pyudev.Device instance, which is based on
> collections.abc.Mapping. That means we can no longer change the data
> to do things like set a "multipath_member" format type or inject LVM
> or MD metadata.
>
> The other difference is that sysfs paths now include the "/sys", which
> is great since it's always mounted in the same place.
>
> (cherry picked from commit 8ff97169daa3fe529e4849e3431d9ec9147c2c20)
> ---
> blivet/devices.py | 96 +++++++---------------
> blivet/devicetree.py | 64 +++++++--------
> blivet/pyudev.py | 226 ---------------------------------------------------
> blivet/udev.py | 142 +++++++++-----------------------
> blivet/util.py | 2 +-
> python-blivet.spec | 1 +
> tests/udev_test.py | 130 +----------------------------
> 7 files changed, 107 insertions(+), 554 deletions(-)
> delete mode 100644 blivet/pyudev.py
>
> diff --git a/blivet/devices.py b/blivet/devices.py
> index 6724071..d78ff5b 100644
> --- a/blivet/devices.py
> +++ b/blivet/devices.py
> @@ -27,6 +27,7 @@ import tempfile
> import abc
> from decimal import Decimal
> import re
> +import pyudev
>
> from six import add_metaclass
>
> @@ -107,7 +108,7 @@ def deviceNameToDiskByPath(deviceName=None):
> return ""
>
> ret = None
> - for dev in udev.get_block_devices():
> + for dev in udev.get_devices():
> if udev.device_get_name(dev) == deviceName:
> ret = udev.device_get_by_path(dev)
> break
> @@ -523,7 +524,6 @@ class StorageDevice(Device):
>
> _type = "blivet"
> _devDir = "/dev"
> - sysfsBlockDir = "class/block"
> _formatImmutable = False
> _partitionable = False
> _isDisk = False
> @@ -789,11 +789,22 @@ class StorageDevice(Device):
>
> def updateSysfsPath(self):
> """ Update this device's sysfs path. """
> - log_method_call(self, self.name, status=self.status)
> - sysfsName = self.name.replace("/", "!")
This looks like something nasty needed for some weird storage HW. Do we
really want to drop this line? IOW, does
pyudev.Device.from_device_file() handle the '/'s and '!'s correctly?
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list