Skip to content

Commit

Permalink
Store vendor/model information for DiskDevice instances.
Browse files Browse the repository at this point in the history
Also make sure _model and _vendor attrs are never set to None in the
StorageDevice constructor.

Fixes #84
  • Loading branch information
dwlehman committed May 8, 2015
1 parent 7ca19a7 commit 9b56e89
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
6 changes: 5 additions & 1 deletion blivet/devices/disk.py
Expand Up @@ -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. """
Expand Down
4 changes: 2 additions & 2 deletions blivet/devices/storage.py
Expand Up @@ -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
Expand Down
9 changes: 3 additions & 6 deletions blivet/populator.py
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 9b56e89

Please sign in to comment.