diff --git a/lib/component.py b/lib/component.py index f579139c124bf43930bf12bc750a2fa5c258f9ec..0b0ff7c53f1adcba30b2537dbbb4a1b630cb91a7 100644 --- a/lib/component.py +++ b/lib/component.py @@ -404,6 +404,9 @@ class Storage(Component): logging.warning('No available controller for storage.') else: for key, val in self.all_disks.items(): + if not val[0] or not val[1]: + logging.debug('disk %s info is %s' % (key, val)) + continue for partition in val[2]: partition.properties.update({'DRIVE_FULL_NAME': val[1].get_property('DRIVE_FULL_NAME')}) for _ in range(len(self.available)): @@ -497,6 +500,7 @@ class Storage(Component): break else: logging.warning('failed to detect the disk for %s' % dk.dev_path) + logging.debug('all disk info: %s' % self.all_disks) disk_size_gb = get_disk_size(dk.get_property('DEVNAME')) if disk_size_gb < 10: logging.warning('%s size is %sG, skip this disk' % (dk.dev_path, disk_size_gb)) diff --git a/lib/utils.py b/lib/utils.py index 0addf550a42a867d6b5cd4510924ba4ee430418f..063830fb17ec3393b13a52610586391f98daf0f8 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -512,7 +512,7 @@ def has_swap_partition(devpath): return True def has_mdstat(devpath): - cmd = 'mdadm -Dsv | grep %s' % devpath + cmd = 'mdadm -Dsv | grep -w %s' % devpath rc, output = run_local_cmd(cmd, shell=True) if rc: return False diff --git a/utils/collect_host_info.sh b/utils/collect_host_info.sh index 7fdf11b19b25eeb9dea26d599c9b34ffa53d0d78..b5981e6640b0036793a41cc04193794126c22510 100644 --- a/utils/collect_host_info.sh +++ b/utils/collect_host_info.sh @@ -75,4 +75,7 @@ echo "collect lsmod information" run_cmd "lsmod" "lsmod" echo "collect memory information" -run_cmd "cat /proc/meminfo" "cat_proc_meminfo" \ No newline at end of file +run_cmd "cat /proc/meminfo" "cat_proc_meminfo" + +echo "collect soft raid configure" +run_cmd "mdadm -Dsv" "mdadm_Dsv"