@@ -42,6 +42,30 @@ class TestStorageSmart(storagelib.StorageSmartCase):
4242
4343 return version > (2 , 10 , 1 )
4444
45+ def has_new_libblockdev (self ):
46+ m = self .machine
47+
48+ if m .image .startswith ("fedora" ) or m .image .startswith ("rhel" ) or m .image .startswith ("centos" ):
49+ version_str = self .machine .execute ("rpm -q libblockdev --qf '%{NAME} %{VERSION}-%{RELEASE}\n '" ).strip ()
50+ elif m .image .startswith ("debian" ) or m .image .startswith ("ubuntu" ):
51+ version_str = self .machine .execute ("dpkg-query -f '${Package} ${Version}\n ' --show libblockdev" ).strip ()
52+ elif m .image == "arch" :
53+ version_str = self .machine .execute ("pacman -Q libblockdev" ).strip ()
54+ else :
55+ return False
56+
57+ base_ver , sub_ver = version_str .split ()[1 ].split ('-' )
58+ base_ver = tuple (int (v ) for v in base_ver .split ('.' ))
59+ # split on `dot` to remove extra info from rpm
60+ sub_ver = int (sub_ver .split ('.' )[0 ])
61+
62+ if base_ver > (3 , 3 , 0 ):
63+ return True
64+ elif base_ver == (3 , 3 , 0 ) and sub_ver >= 99 :
65+ return True
66+ else :
67+ return False
68+
4569 def testSmart (self ):
4670 def set_smart_dump (name : str , block : str ):
4771 self .machine .execute (f"udisksctl smart-simulate -f /tmp/smart-dumps/{ name } -b { block } " )
@@ -53,8 +77,10 @@ class TestStorageSmart(storagelib.StorageSmartCase):
5377 b .wait_in_text (self .card_desc ("Device health (SMART)" , "Self-test status" ), status )
5478 if bad_sectors is not None :
5579 b .wait_in_text (self .card_desc ("Device health (SMART)" , "Number of bad sectors" ), bad_sectors )
80+ b .wait_visible (self .card_desc ("Device health (SMART)" , "Number of bad sectors" ) + " .pf-m-warning" )
5681 if failing_attrs is not None :
5782 b .wait_in_text (self .card_desc ("Device health (SMART)" , "Attributes failing" ), failing_attrs )
83+ b .wait_visible (self .card_desc ("Device health (SMART)" , "Attributes failing" ) + " .pf-m-warning" )
5884
5985 m = self .machine
6086 b = self .browser
@@ -82,17 +108,27 @@ class TestStorageSmart(storagelib.StorageSmartCase):
82108 set_smart_dump ("INTEL_SSDSA2MH080G1GC--045C8820" , "/dev/sda" )
83109 check_smart_info ("Disk is OK" , "2309 hours" , "Interrupted" )
84110
85- # Aborted self test and has known bad sector
111+ # latest libblockdev builds (since 3.3.0-99) from copr have different behavior when assessing disk as failed
112+ has_new_libblockdev = self .has_new_libblockdev ()
113+
114+ # Aborted self test and has known bad sector (overall assessment is still OK)
86115 set_smart_dump ("ST9160821AS--3.CLH" , "/dev/sda" )
87- check_smart_info ("Disk is failing" , "556 hours" , "Aborted" , bad_sectors = "1" )
116+ if has_new_libblockdev :
117+ check_smart_info ("Disk is OK" , "556 hours" , "Aborted" , bad_sectors = "1" )
118+ else :
119+ check_smart_info ("Disk is failing" , "556 hours" , "Aborted" , bad_sectors = "1" )
88120
89121 # Multiple bad sectors
90122 set_smart_dump ("Maxtor_96147H8--BAC51KJ0" , "/dev/sda" )
91- check_smart_info ("Disk is failing" , "2016 hours" , "Successful" , bad_sectors = "71" )
123+ if has_new_libblockdev :
124+ check_smart_info ("Disk is OK" , "2016 hours" , "Successful" , bad_sectors = "71" )
125+ else :
126+ check_smart_info ("Disk is failing" , "2016 hours" , "Successful" , bad_sectors = "71" )
92127
93128 # Multiple bad sectors with failing attribute
94129 set_smart_dump ("Maxtor_96147H8--BAC51KJ0--2" , "/dev/sda" )
95130 check_smart_info ("Disk is failing" , "2262 hours" , "Successful" , bad_sectors = "71" , failing_attrs = "1" )
131+ b .wait_visible (self .card_desc ("Device health (SMART)" , "Assessment" ) + " .pf-m-danger" )
96132
97133 # Check that SMART card is not visible on DVD drive
98134 b .go ("/storage" )
0 commit comments