Skip to content

Commit

Permalink
Merge pull request rockstor#1071 from phillxnet/1063_enhance_scan_dis…
Browse files Browse the repository at this point in the history
…ks_for_md

enhance scan disks for md rockstor#1063
  • Loading branch information
schakrava committed Dec 30, 2015
2 parents 4c0a998 + 0618c2c commit 97ac482
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/rockstor/fs/btrfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,7 @@ def scan_disks(min_size):
root_serial = None
# to use udevadm to retrieve serial number rather than lsblk, make this True
always_use_udev_serial = False
device_names_seen = []
for l in o:
if (re.match('NAME', l) is None):
continue
Expand Down Expand Up @@ -814,6 +815,15 @@ def scan_disks(min_size):
i = i + 1
else:
raise Exception('Failed to parse lsblk output: %s' % sl)
# md devices, such as mdadmin software raid and some hardware raid block
# devices show up in lsblk's output multiple times with identical info.
# Given we only need one copy of this info we remove duplicate device
# name entries, also offers more sane output to views/disk.py where name
# will be used as the index
if (dmap['NAME'] in device_names_seen):
continue
device_names_seen.append(dmap['NAME'])
# We are not interested in CD / DVD rom devices so skip to next device
if (dmap['TYPE'] == 'rom'):
continue
if (dmap['NAME'] == root):
Expand Down

0 comments on commit 97ac482

Please sign in to comment.