!57 [sync] PR-54: Fix FC and raid cannot get the new disk partition

From: @openeuler-sync-bot 
Reviewed-by: @meitingli 
Signed-off-by: @meitingli
This commit is contained in:
openeuler-ci-bot 2022-08-01 11:49:11 +00:00 committed by Gitee
commit 54dded057d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 74 additions and 1 deletions

View File

@ -0,0 +1,68 @@
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." %

View File

@ -5,7 +5,7 @@
Name: oec-hardware
Summary: openEuler Hardware Compatibility Test Suite
Version: 1.1.1
Release: 1
Release: 2
Group: Development/Tools
License: Mulan PSL v2
URL: https://gitee.com/openeuler/oec-hardware
@ -13,6 +13,7 @@ Source0: https://gitee.com/openeuler/oec-hardware/repository/archive/v%{v
# patch fix issue
Patch0001: oec-hardware-1.1.1-fix-vesion.patch
Patch0002: oec-hardware-1.1.1-fix-fc-raid.patch
Buildroot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: gcc
@ -36,6 +37,7 @@ openEuler Hardware Compatibility Test Server
%prep
%setup -q -c
%patch1 -p1
%patch2 -p1
%build
@ -77,6 +79,9 @@ DESTDIR=$RPM_BUILD_ROOT make install
rm -rf /var/lock/oech.lock
%changelog
* Mon Aug 1 2022 cuixucui <cuixucui1@h-partners> - 1.1.1-2
- Fix FC and raid cannot get the new hard disk partition
* Sat Jul 30 2022 ylzhangah <1194926515@qq.com> - 1.1.1-1
- Change the version in version.config to 1.1.1