From 22a6160598e6dc3e040699c78be08483f26f790c Mon Sep 17 00:00:00 2001 From: cuixucui <350255958@qq.com> Date: Wed, 3 Aug 2022 12:36:53 +0800 Subject: [PATCH] Fix the client send message to the server failed after the server port is modified (cherry picked from commit 76f0c2de6afb1a097047796c68bb70ca464d7d40) --- ...-1.1.1-fix-network-infiniband-system.patch | 323 ++++++++++++++++++ oec-hardware.spec | 10 +- 2 files changed, 331 insertions(+), 2 deletions(-) create mode 100644 oec-hardware-1.1.1-fix-network-infiniband-system.patch diff --git a/oec-hardware-1.1.1-fix-network-infiniband-system.patch b/oec-hardware-1.1.1-fix-network-infiniband-system.patch new file mode 100644 index 0000000..0bda44c --- /dev/null +++ b/oec-hardware-1.1.1-fix-network-infiniband-system.patch @@ -0,0 +1,323 @@ +diff -Naur rpm/tests/infiniband/infiniband.py oech/tests/infiniband/infiniband.py +--- rpm/tests/infiniband/infiniband.py 2022-08-03 18:05:22.031340460 +0800 ++++ oech/tests/infiniband/infiniband.py 2022-08-03 18:02:43.727340460 +0800 +@@ -29,6 +29,7 @@ + self.target_bandwidth_percent = 0.5 + self.config_data = dict() + self.server_ip = "" ++ self.server_port = "80" + self.args = None + + def test_ib_link(self): +@@ -68,6 +69,8 @@ + self.config_data = getattr(self.args, "config_data", None) + if self.config_data: + self.server_ip = self.config_data.get("server_ip", "") ++ if ":" in self.server_ip: ++ self.server_ip, self.server_port = self.server_ip.split(":") + else: + self.logger.error("Failed to test item value from configuration file.") + +diff -Naur rpm/tests/infiniband/network.py oech/tests/infiniband/network.py +--- rpm/tests/infiniband/network.py 2022-08-03 18:05:22.031340460 +0800 ++++ oech/tests/infiniband/network.py 2022-08-03 18:02:43.727340460 +0800 +@@ -34,6 +34,7 @@ + self.interface = None + self.other_interfaces = [] + self.server_ip = None ++ self.server_port = "80" + self.retries = 3 + self.speed = 1000 # Mb/s + self.target_bandwidth_percent = 0.8 +@@ -94,7 +95,7 @@ + form = dict() + form['cmd'] = cmd + form['ib_server_ip'] = ib_server_ip +- url = 'http://%s/api/%s' % (self.server_ip, act) ++ url = 'http://%s:%s/api/%s' % (self.server_ip, self.server_port, act) + data = urlencode(form).encode('utf8') + headers = { + 'Content-type': 'application/x-www-form-urlencoded', +diff -Naur rpm/tests/network/ethernet.py oech/tests/network/ethernet.py +--- rpm/tests/network/ethernet.py 2022-08-03 18:05:22.031340460 +0800 ++++ oech/tests/network/ethernet.py 2022-08-03 18:02:43.727340460 +0800 +@@ -33,6 +33,7 @@ + self.device = None + self.config_data = dict() + self.server_ip = "" ++ self.server_port = "80" + self.subtests = [self.test_ip_info, self.test_eth_link, self.test_icmp, + self.test_udp_tcp, self.test_http] + self.target_bandwidth_percent = 0.75 +@@ -61,7 +62,9 @@ + self.show_driver_info() + self.config_data = getattr(args, "config_data", None) + if self.config_data: +- self.server_ip = self.config_data.get("server_ip") ++ self.server_ip = self.config_data.get("server_ip", "") ++ if ":" in self.server_ip: ++ self.server_ip, self.server_port = self.server_ip.split(":") + choice = self.config_data.get("if_rdma") + else: + self.logger.error("Get test item value from configuration file failed.") +diff -Naur rpm/tests/network/network.py oech/tests/network/network.py +--- rpm/tests/network/network.py 2022-08-03 18:05:22.031340460 +0800 ++++ oech/tests/network/network.py 2022-08-03 18:02:43.727340460 +0800 +@@ -22,6 +22,7 @@ + + from hwcompatible.test import Test + from hwcompatible.command import Command ++from hwcompatible.constants import FILE_FLAGS, FILE_MODES + + + class NetworkTest(Test): +@@ -33,6 +34,7 @@ + self.requirements = ['ethtool', 'iproute', 'psmisc', 'qperf'] + self.retries = 3 + self.testfile = 'testfile' ++ self.speed = 0 + + def ifdown(self, interface): + """ +@@ -72,7 +74,7 @@ + return int(speed) + except Exception: + self.logger.error("[X] No speed found on the interface.") +- return None ++ return 0 + + def get_interface_ip(self): + """ +@@ -86,7 +88,7 @@ + return ip_addr + except Exception: + self.logger.error("[X] No available ip on the interface.") +- return None ++ return "" + + def test_icmp(self): + """ +@@ -98,14 +100,14 @@ + pattern = r".*, (?P\d+\.{0,1}\d*)% packet loss.*" + + for _ in range(self.retries): ++ self.logger.info(com.command) + try: +- self.logger.info(com.command) + loss = com.get_str(pattern, 'loss', False) +- com.print_output() +- if float(loss) == 0: +- return True + except Exception as concrete_error: + self.logger.error(concrete_error) ++ if float(loss) == 0: ++ return True ++ com.print_output() + return False + + def call_remote_server(self, cmd, act='start', ib_server_ip=''): +@@ -119,14 +121,15 @@ + form = dict() + form['cmd'] = cmd + form['ib_server_ip'] = ib_server_ip +- url = 'http://%s/api/%s' % (self.server_ip, act) ++ url = 'http://%s:%s/api/%s' % (self.server_ip, self.server_port, act) + data = urlencode(form).encode('utf8') + headers = { + 'Content-type': 'application/x-www-form-urlencoded', + 'Accept': 'text/plain' + } ++ ++ request = Request(url, data=data, headers=headers) + try: +- request = Request(url, data=data, headers=headers) + response = urlopen(request) + except Exception as concrete_error: + self.logger.error(str(concrete_error)) +@@ -169,19 +172,20 @@ + for _ in range(self.retries): + try: + bandwidth = com.get_str(pattern, 'bandwidth', False) +- band_width = bandwidth.split() +- if 'GB' in band_width[1]: +- bandwidth = float(band_width[0]) * 8 * 1024 +- else: +- bandwidth = float(band_width[0]) * 8 +- +- target_bandwidth = self.target_bandwidth_percent * self.speed +- self.logger.info("Current bandwidth is %.2fMb/s, target is %.2fMb/s" % +- (bandwidth, target_bandwidth)) +- if bandwidth > target_bandwidth: +- return True + except Exception as concrete_error: + self.logger.error(concrete_error) ++ band_width = bandwidth.split() ++ if 'GB' in band_width[1]: ++ bandwidth = float(band_width[0]) * 8 * 1024 ++ else: ++ bandwidth = float(band_width[0]) * 8 ++ ++ target_bandwidth = self.target_bandwidth_percent * self.speed ++ self.logger.info( ++ "Current bandwidth is %.2fMb/s, target is %.2fMb/s" % ++ (bandwidth, target_bandwidth)) ++ if bandwidth > target_bandwidth: ++ return True + return False + + def create_testfile(self): +@@ -212,7 +216,7 @@ + + form['filename'] = filename + form['filetext'] = filetext +- url = 'http://%s/api/file/upload' % self.server_ip ++ url = 'http://%s:%s/api/file/upload' % (self.server_ip, self.server_port) + data = urlencode(form).encode('utf8') + headers = { + 'Content-type': 'application/x-www-form-urlencoded', +@@ -220,8 +224,8 @@ + } + + time_start = time.time() ++ request = Request(url, data=data, headers=headers) + try: +- request = Request(url, data=data, headers=headers) + response = urlopen(request) + except Exception as concrete_error: + self.logger.error(concrete_error) +@@ -242,7 +246,7 @@ + :return: + """ + filename = os.path.basename(self.testfile) +- url = "http://%s/files/%s" % (self.server_ip, filename) ++ url = "http://%s:%s/files/%s" % (self.server_ip, self.server_port, filename) + + time_start = time.time() + try: +@@ -257,7 +261,8 @@ + self.logger.info(str(response.headers), terminal_print=False) + filetext = response.read() + try: +- with open(self.testfile, 'wb') as file_info: ++ with os.fdopen(os.open(self.testfile, FILE_FLAGS, FILE_MODES), ++ "wb") as file_info: + file_info.write(filetext) + except Exception as concrete_error: + self.logger.error(concrete_error) +diff -Naur rpm/tests/system/system.py oech/tests/system/system.py +--- rpm/tests/system/system.py 2022-08-03 18:13:04.395340460 +0800 ++++ oech/tests/system/system.py 2022-08-03 18:06:55.651340460 +0800 +@@ -69,17 +69,16 @@ + self.logger.info("Checking installed cert package...") + for cert_package in ["oec-hardware"]: + rpm_verify = Command( +- "rpm -V --nomtime --nomode --nocontexts %s &>> %s" % +- (cert_package, self.logger.logfile)) +- rpm_verify.echo(ignore_errors=True) +- output = rpm_verify.read().split('\n') +- for file in output: +- if "test_config.yaml" in file: +- continue +- else: +- self.logger.error( +- "Files in %s have been tampered." % cert_package) +- return False ++ "rpm -V --nomtime --nomode --nocontexts %s" % cert_package) ++ output = rpm_verify.read() ++ if output: ++ for file in output.split('\n'): ++ if "test_config.yaml" in file: ++ continue ++ else: ++ self.logger.error("Files in %s have beem tampered. \nThe tampered files are as follows:\n %s" % ++ (cert_package, output)) ++ return False + return True + + def check_kernel(self): +@@ -173,85 +172,6 @@ + proc_modules.close() + return modules + +- def abi_check(self, module): +- """ +- Check abi whitelist +- :param module: +- :return: +- """ +- whitelist_path = [("/lib/modules/kabi-current/kabi_whitelist_" + self.sysinfo.arch), +- ("/lib/modules/kabi/kabi_whitelist_" + self.sysinfo.arch), +- ("/usr/src/kernels/%s/kabi_whitelist" % +- self.sysinfo.kernel) +- ] +- whitelist = "" +- for whitelist in whitelist_path: +- if os.path.exists(whitelist): +- break +- +- if not os.path.exists(whitelist): +- self.logger.error( +- "Unable not find whitelist file in any of the following locations:") +- self.logger.error("\n".join(whitelist_path)) +- return False +- +- whitelist_symbols = self.read_abi_whitelist(whitelist) +- if not whitelist_symbols: +- return False +- module_symbols = self.read_module(module) +- if not module_symbols: +- return False +- extra_symbols = list() +- for symbol in module_symbols: +- if symbol not in whitelist_symbols: +- extra_symbols.append(symbol) +- +- black_symbols = list() +- if extra_symbols: +- greylist = "/usr/share/doc/kmod-%s/greylist.txt" % module +- if os.path.exists(greylist): +- self.logger.info("checking greylist for %s" % module) +- greylist_symbols = self.read_abi_whitelist(greylist) +- for symbol in extra_symbols: +- if symbol not in greylist_symbols: +- black_symbols.append(symbol) +- else: +- black_symbols = extra_symbols +- +- if black_symbols: +- self.logger.error("The following symbols are used by %s are not on the ABI \ +- whitelist." % module) +- for symbol in black_symbols: +- self.logger.error(symbol) +- return False +- return True +- +- def read_abi_whitelist(self, whitelist): +- """ +- Read abi whitelist +- :param whitelist: +- :return: +- """ +- symbols = list() +- if not os.path.isfile(whitelist): +- self.logger.error("Failed to read the whitelist file") +- return None +- +- whitelistfile = open(whitelist, "r") +- while True: +- line = whitelistfile.readline() +- if line == "": +- break +- if line == "\n": +- continue +- line.split() +- if line[0] == '[': +- continue +- symbol = line.strip() +- symbols.append(symbol) +- +- return symbols +- + def read_module(self, module): + """ + Read module diff --git a/oec-hardware.spec b/oec-hardware.spec index 0645318..6f865df 100644 --- a/oec-hardware.spec +++ b/oec-hardware.spec @@ -5,7 +5,7 @@ Name: oec-hardware Summary: openEuler Hardware Compatibility Test Suite Version: 1.1.1 -Release: 2 +Release: 3 Group: Development/Tools License: Mulan PSL v2 URL: https://gitee.com/openeuler/oec-hardware @@ -14,6 +14,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 +Patch0003: oec-hardware-1.1.1-fix-network-infiniband-system.patch Buildroot: %{_tmppath}/%{name}-%{version}-root BuildRequires: gcc @@ -38,6 +39,7 @@ openEuler Hardware Compatibility Test Server %setup -q -c %patch1 -p1 %patch2 -p1 +%patch3 -p1 %build @@ -79,8 +81,12 @@ DESTDIR=$RPM_BUILD_ROOT make install rm -rf /var/lock/oech.lock %changelog +* Wed Aug 3 2022 cuixucui - 1.1.1-3 +- Fix the problem that the client fails to send messages after the server port is modified +- Fix the problem that the system test item failed to check the integrity of the software package + * Mon Aug 1 2022 cuixucui - 1.1.1-2 -- Fix FC and raid cannot get the new hard disk partition +- Fix the problem that 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 -- Gitee