[blivet:master 1/2] Remove all references to DeviceFormat.majorminor
mulhern
amulhern at redhat.com
Mon Jul 7 22:15:47 UTC 2014
And remove a bit of related code as well. Last uses of majorminor were
removed in anaconda commit d819bb940717270f4c5747e894ef0c5ac509dfe2.
majorminor was originally added in commit
2875d2009f30f52b79f6f7d15916f73b490bc635.
Signed-off-by: mulhern <amulhern at redhat.com>
---
blivet/devices.py | 1 -
blivet/formats/__init__.py | 44 --------------------------------------------
2 files changed, 45 deletions(-)
diff --git a/blivet/devices.py b/blivet/devices.py
index 4a485e8..7db3c95 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -859,7 +859,6 @@ class StorageDevice(Device):
if self.originalFormat.exists:
self.originalFormat.teardown()
- self.format.cacheMajorminor()
if self.format.exists:
self.format.teardown()
udev.udev_settle()
diff --git a/blivet/formats/__init__.py b/blivet/formats/__init__.py
index 154f305..8b1d2fa 100644
--- a/blivet/formats/__init__.py
+++ b/blivet/formats/__init__.py
@@ -22,7 +22,6 @@
import os
-from ..udev import udev_get_device
from ..util import notify_kernel
from ..util import get_sysfs_path_by_name
from ..util import run_program
@@ -31,7 +30,6 @@ from ..storage_log import log_method_call
from ..errors import DeviceFormatError, DMError, FormatCreateError, FormatDestroyError, FormatSetupError, MDRaidError, StorageError
from ..devicelibs.dm import dm_node_from_name
from ..devicelibs.mdraid import md_node_from_name
-from ..udev import udev_device_get_major, udev_device_get_minor
from ..i18n import _, N_
from ..size import Size
@@ -185,7 +183,6 @@ class DeviceFormat(ObjectID):
self.uuid = kwargs.get("uuid")
self.exists = kwargs.get("exists")
self.options = kwargs.get("options")
- self._majorminor = None
# don't worry about existence if this is a DeviceFormat instance
#if self.__class__ is DeviceFormat:
@@ -349,25 +346,6 @@ class DeviceFormat(ObjectID):
except (ValueError, IOError) as e:
log.warning("failed to notify kernel of change: %s", e)
- def cacheMajorminor(self):
- """ Cache the value of self.majorminor.
-
- Once a device node of this format's device disappears (for instance
- after a teardown), it is no longer possible to figure out the value
- of self.majorminor pseudo-unique string. Call this method before
- that happens for caching this.
- """
- self._majorminor = None
- try:
- self.majorminor # this does the caching
- except StorageError:
- # entirely possible there's no majorminor, for instance an
- # LVMVolumeGroup has got no device node and no sysfs path. In this
- # case obviously, calling majorminor of this object later raises an
- # exception.
- pass
- return self._majorminor
-
def create(self, **kwargs):
""" Write the formatting to the specified block device.
@@ -519,28 +497,6 @@ class DeviceFormat(ObjectID):
return self._hidden
@property
- def majorminor(self):
- """A string suitable for using as a pseudo-unique ID in kickstart."""
- if not self._majorminor:
- # If this is a device-mapper device, we have to get the DM node and
- # build the sysfs path from that.
- try:
- device = dm_node_from_name(os.path.basename(self.device))
- except DMError:
- device = self.device
-
- try:
- sysfs_path = get_sysfs_path_by_name(device)
- except RuntimeError:
- raise StorageError("DeviceFormat.majorminor: "
- "can not get majorminor for '%s'" % device)
- dev = udev_get_device(sysfs_path[4:])
-
- self._majorminor = "%03d%03d" %\
- (udev_device_get_major(dev), udev_device_get_minor(dev))
- return self._majorminor
-
- @property
def ksMountpoint(self):
return (self._ksMountpoint or self.type or "")
--
1.9.3
More information about the anaconda-patches
mailing list