diff options
author | Peter Schiffer <pschiffe@redhat.com> | 2013-12-10 19:23:37 +0100 |
---|---|---|
committer | Peter Schiffer <pschiffe@redhat.com> | 2013-12-10 19:23:37 +0100 |
commit | e99df5fdba9bb16dfec1e1a80f001fe97622e71b (patch) | |
tree | 2482189e6d504ee20fb6e957aa3303164ee5aa91 /src/hardware/smartctl.c | |
parent | 4d3e9d9f3bda71faf6b46286e1ad78fb0e3696cf (diff) | |
download | openlmi-providers-e99df5fdba9bb16dfec1e1a80f001fe97622e71b.tar.gz openlmi-providers-e99df5fdba9bb16dfec1e1a80f001fe97622e71b.tar.xz openlmi-providers-e99df5fdba9bb16dfec1e1a80f001fe97622e71b.zip |
Hardware: use lsblk as primary source for disks
This patch makes lsblk primary source for information about disks instead of
smartctl. This change was needed because in virtual environment some disks might
be recognized by smartctl while others not, and in this case, some disks would
be missing in LMI classes. With lsblk, all disks are always listed. Smartctl
is used as source of additional information if avaiable.
Diffstat (limited to 'src/hardware/smartctl.c')
-rw-r--r-- | src/hardware/smartctl.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/hardware/smartctl.c b/src/hardware/smartctl.c index afa690f..4e7c04c 100644 --- a/src/hardware/smartctl.c +++ b/src/hardware/smartctl.c @@ -215,10 +215,22 @@ short smartctl_get_hdds(SmartctlHdd **hdds, unsigned *hdds_nb) /* Model */ buf = copy_string_part_after_delim(buffer[i], "Device Model:"); if (buf) { + free((*hdds)[curr_hdd].model); (*hdds)[curr_hdd].model = buf; buf = NULL; continue; } + /* Model, second version */ + buf = copy_string_part_after_delim(buffer[i], "Product:"); + if (buf) { + if (!(*hdds)[curr_hdd].model) { + (*hdds)[curr_hdd].model = buf; + } else { + free(buf); + } + buf = NULL; + continue; + } /* Serial Number */ buf = copy_string_part_after_delim(buffer[i], "Serial Number:"); if (buf) { |