[master 1/1] Store vendor/model information for DiskDevice instances.
dwlehman
installerbot-noreply at redhat.com
Fri May 8 15:46:28 UTC 2015
From: David Lehman <dlehman at redhat.com>
Also make sure _model and _vendor attrs are never set to None in the
StorageDevice constructor.
Fixes #84
---
blivet/devices/disk.py | 6 +++++-
blivet/devices/storage.py | 4 ++--
blivet/populator.py | 9 +++------
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/blivet/devices/disk.py b/blivet/devices/disk.py
index 39acea2..c727c74 100644
--- a/blivet/devices/disk.py
+++ b/blivet/devices/disk.py
@@ -105,7 +105,11 @@ def mediaPresent(self):
@property
def description(self):
- return self.model
+ desc = self.vendor
+ if desc:
+ desc += " "
+ desc += self.model
+ return desc
def _preDestroy(self):
""" Destroy the device. """
diff --git a/blivet/devices/storage.py b/blivet/devices/storage.py
index 052b397..87181ac 100644
--- a/blivet/devices/storage.py
+++ b/blivet/devices/storage.py
@@ -113,8 +113,8 @@ def __init__(self, name, fmt=None, uuid=None,
self.major = util.numeric_type(major)
self.minor = util.numeric_type(minor)
self._serial = serial
- self._vendor = vendor
- self._model = model
+ self._vendor = vendor or ""
+ self._model = model or ""
self.bus = bus
self._readonly = False
diff --git a/blivet/populator.py b/blivet/populator.py
index 1a21345..157178a 100644
--- a/blivet/populator.py
+++ b/blivet/populator.py
@@ -476,12 +476,10 @@ def addUdevDiskDevice(self, info):
serial = udev.device_get_serial(info)
bus = udev.device_get_bus(info)
- # udev doesn't always provide a vendor.
- vendor = udev.device_get_vendor(info)
- if not vendor:
- vendor = ""
+ vendor = util.get_sysfs_attr(sysfs_path, "device/vendor")
+ model = util.get_sysfs_attr(sysfs_path, "device/model")
- kwargs = { "serial": serial, "vendor": vendor, "bus": bus }
+ kwargs = { "serial": serial, "vendor": vendor, "model": model, "bus": bus }
if udev.device_is_iscsi(info):
diskType = iScsiDiskDevice
initiator = udev.device_get_iscsi_initiator(info)
@@ -561,7 +559,6 @@ def addUdevDiskDevice(self, info):
device = diskType(name,
major=udev.device_get_major(info),
minor=udev.device_get_minor(info),
- model=udev.device_get_model(info),
sysfsPath=sysfs_path, **kwargs)
if diskType == DASDDevice:
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/9b56e89720642f4b1c54a34756f0131c9bdd449b
More information about the anaconda-patches
mailing list