69 lines
2.7 KiB
Diff
69 lines
2.7 KiB
Diff
diff -Naur rpm/tests/fc/fc.py oech/tests/fc/fc.py
|
|
--- rpm/tests/fc/fc.py 2022-08-01 17:27:14.639340460 +0800
|
|
+++ oech/tests/fc/fc.py 2022-08-01 17:25:50.615340460 +0800
|
|
@@ -20,6 +20,7 @@
|
|
|
|
from hwcompatible.test import Test
|
|
from hwcompatible.command import Command
|
|
+from hwcompatible.device import CertDevice
|
|
|
|
|
|
class FCTest(Test):
|
|
@@ -102,10 +103,14 @@
|
|
"""
|
|
self.disks = list()
|
|
disks = list()
|
|
- disk_info = Command("cd /sys/block; ls -l").read().split('\n')
|
|
- for disk in disk_info:
|
|
- if self.pci_num in disk:
|
|
- disks.append(disk.split('/')[-1])
|
|
+ devices = CertDevice(self.logger).get_devices()
|
|
+ for device in devices:
|
|
+ if (device.get_property("DEVTYPE") == "disk" and not
|
|
+ device.get_property("ID_TYPE")) or device.\
|
|
+ get_property("ID_TYPE") == "disk":
|
|
+ if "/host" in device.get_property("DEVPATH") and \
|
|
+ self.pci_num in device.get_property("DEVPATH"):
|
|
+ disks.append(device.get_name())
|
|
|
|
partition_file = open("/proc/partitions", "r")
|
|
partition = partition_file.read()
|
|
diff -Naur rpm/tests/raid/raid.py oech/tests/raid/raid.py
|
|
--- rpm/tests/raid/raid.py 2022-08-01 17:27:14.643340460 +0800
|
|
+++ oech/tests/raid/raid.py 2022-08-01 17:25:50.615340460 +0800
|
|
@@ -20,6 +20,7 @@
|
|
|
|
from hwcompatible.test import Test
|
|
from hwcompatible.command import Command
|
|
+from hwcompatible.device import CertDevice
|
|
|
|
|
|
class RaidTest(Test):
|
|
@@ -102,10 +103,14 @@
|
|
"""
|
|
self.disks = list()
|
|
disks = list()
|
|
- disk_info = Command("cd /sys/block; ls -l").read().split('\n')
|
|
- for disk in disk_info:
|
|
- if self.pci_num in disk:
|
|
- disks.append(disk.split('/')[-1])
|
|
+ devices = CertDevice(self.logger).get_devices()
|
|
+ for device in devices:
|
|
+ if (device.get_property("DEVTYPE") == "disk" and not
|
|
+ device.get_property("ID_TYPE")) or device.\
|
|
+ get_property("ID_TYPE") == "disk":
|
|
+ if "/host" in device.get_property("DEVPATH") and \
|
|
+ self.pci_num in device.get_property("DEVPATH"):
|
|
+ disks.append(device.get_name())
|
|
|
|
partition_file = open("/proc/partitions", "r")
|
|
partition = partition_file.read()
|
|
@@ -136,7 +141,6 @@
|
|
if disk in mdstat or os.system("pvs 2>/dev/null | grep -q '/dev/%s'" % disk) == 0:
|
|
continue
|
|
self.disks.append(disk)
|
|
-
|
|
un_suitable = list(set(disks).difference(set(self.disks)))
|
|
if len(un_suitable) > 0:
|
|
self.logger.info("These disks %s are in use now, skip them." %
|