From e38f273766eb744ef0e0595ccd5f43552cc2dc07 Mon Sep 17 00:00:00 2001 From: Praveen K Pandey Date: Mon, 13 May 2024 08:13:42 +0530 Subject: [PATCH 1/6] Added library function which retun True/False if performance collection attribute set to LPAR profile Added library function which retun True/False if performance collection attribute set to LPAR profile Signed-off-by: Praveen K Pandey --- common/OpTestHMC.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/common/OpTestHMC.py b/common/OpTestHMC.py index de947375..920cef16 100644 --- a/common/OpTestHMC.py +++ b/common/OpTestHMC.py @@ -863,6 +863,19 @@ def is_msp_enabled(self, mg_system, vios_name, remote_hmc=None): if int(msp_output[0]) != 1: return False return True + + def is_perfcollection_enabled(self): + ''' + Get Performance Information collection allowed in hmc profile + + :returns: Ture if allow_perf_collection in hmc otherwise false + ''' + + rc = self.run_command("lssyscfg -m %s -r lpar --filter lpar_names=%s -F allow_perf_collection" + % (self.mg_system, self.lpar_name)) + if rc: + return True + return False def gather_logs(self, list_of_commands=[], remote_hmc=None, output_dir=None): ''' From 19116a51452732a631a97cca30c221a75e6f3e42 Mon Sep 17 00:00:00 2001 From: Praveen K Pandey Date: Mon, 13 May 2024 08:14:41 +0530 Subject: [PATCH 2/6] Added a library function which help to set perf collection attribute to LPAR using HMC command Added a library function which help to set perf collection attribute to LPAR using HMC command Signed-off-by: Praveen K Pandey --- common/OpTestHMC.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/common/OpTestHMC.py b/common/OpTestHMC.py index 920cef16..79f726c6 100644 --- a/common/OpTestHMC.py +++ b/common/OpTestHMC.py @@ -877,6 +877,21 @@ def is_perfcollection_enabled(self): return True return False + def hmc_perfcollect_configure(self, enable=True): + ''' + Enable/Disable perfcollection from HMC + The value for enabling perfcollection is 1, and for disabling it is 0. + ''' + + cmd = ('chsyscfg -r lpar -m %s -i "name=%s, allow_perf_collection=' % + (self.mg_system, self.lpar_name)) + if enable: + cmd = '%s1"' % cmd + else: + cmd = '%s0"' % cmd + self.run_command(cmd, timeout=300) + + def gather_logs(self, list_of_commands=[], remote_hmc=None, output_dir=None): ''' Gather the logs for the commands at the given directory From 4b15c2453ff27ba050d56fa8a2e5d86846ce86cd Mon Sep 17 00:00:00 2001 From: Praveen K Pandey Date: Mon, 13 May 2024 08:16:40 +0530 Subject: [PATCH 3/6] Added support in Machine config as perf collection data can be set via dynamic profile Added support in Machine config as perf collection data can be set via dynamic profile Signed-off-by: Praveen K Pandey --- testcases/MachineConfig.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/testcases/MachineConfig.py b/testcases/MachineConfig.py index 61d4afaf..10bf00b6 100755 --- a/testcases/MachineConfig.py +++ b/testcases/MachineConfig.py @@ -203,7 +203,7 @@ class LparConfig(): valid values: cpu=shared or cpu=dedicated vtpm=1 or vtpm=0 vpmem=0 or vpmem=1 - Ex: machine_config="cpu=dedicated,vtpm=1,vpmem=1" + Ex: machine_config="cpu=dedicated,vtpm=1,vpmem=1,perf=1" ''' def __init__(self, cv_HMC=None, system_name=None, @@ -421,6 +421,17 @@ def LparSetup(self, lpar_config=""): if self.sb_enable is not None: self.cv_HMC.hmc_secureboot_on_off(self.sb_enable) + + if "perf=1" in self.machine_config: + conf = OpTestConfiguration.conf + if self.cv_HMC.is_perfcollection_enabled(): + log.info("System is already booted with perf collection profile enabled") + else: + self.cv_HMC.hmc_perfcollect_configure() + if self.cv_HMC.is_perfcollection_enabled: + log.info("System is already booted with perf collection profile enabled") + else: + return "Failed to enable Performance Information collection" self.cv_HMC.poweron_lpar() curr_proc_mode = self.cv_HMC.get_proc_mode() From f4fa4a1356f8605bd2c13391b22709ec2c037bac Mon Sep 17 00:00:00 2001 From: Praveen K Pandey Date: Mon, 13 May 2024 08:19:05 +0530 Subject: [PATCH 4/6] Remove non relevant function docstring Remove non relevant function docstring Signed-off-by: Praveen K Pandey --- common/OpTestHMC.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/common/OpTestHMC.py b/common/OpTestHMC.py index 79f726c6..49408f86 100644 --- a/common/OpTestHMC.py +++ b/common/OpTestHMC.py @@ -180,9 +180,7 @@ def check_lpar_secureboot_state(self, hmc_con): def hmc_secureboot_on_off(self, enable=True): ''' Enable/Disable Secure Boot from HMC - 1. PowerOFF/Shutdown LPAR from HMC - 2. Enable/Disable Secure boot using 'chsyscfg' command - 3. PowerON/Activate the LPAR and boot to Operating System + Enable/Disable Secure boot using 'chsyscfg' command ''' # Set Secure Boot value using HMC command cmd = ('chsyscfg -r lpar -m %s -i "name=%s, secure_boot=' % From 2a1f805da1dc42522826a569b7a7f038f41d6c5b Mon Sep 17 00:00:00 2001 From: Praveen K Pandey Date: Tue, 14 May 2024 11:16:52 +0530 Subject: [PATCH 5/6] Fixed login prompt issue as couple of system has new login prompt added wildcard as :~ as , in couple of system op-test error out as not get exact wild card Signed-off-by: Praveen K Pandey --- common/OpTestUtil.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/OpTestUtil.py b/common/OpTestUtil.py index 03e2d567..f386edd9 100644 --- a/common/OpTestUtil.py +++ b/common/OpTestUtil.py @@ -1484,9 +1484,9 @@ def get_login(self, host, term_obj, pty, prompt): if rc == 0: pty.sendline(my_pwd) time.sleep(0.5) - rc = pty.expect(['login: $', ".*#$", ".*# $", ".*\$", "~ #", + rc = pty.expect(['login: $', ".*#$", ".*# $", ".*\$", "~ #", ":~", 'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=60) - if rc not in [1, 2, 3, 4]: + if rc not in [1, 2, 3, 4, 5]: if term_obj.setup_term_quiet == 0: log.warning("OpTestSystem Problem with the login and/or password prompt," " raised Exception ConsoleSettings but continuing") @@ -1518,9 +1518,9 @@ def get_login(self, host, term_obj, pty, prompt): if rc == 0: pty.sendline(my_pwd) time.sleep(0.5) - rc = pty.expect(['login: $', ".*#$", ".*# $", ".*\$", "~ #", + rc = pty.expect(['login: $', ".*#$", ".*# $", ".*\$", "~ #", ":~", 'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=10) - if rc not in [1, 2, 3, 4]: + if rc not in [1, 2, 3, 4, 5]: if term_obj.setup_term_quiet == 0: log.warning("OpTestSystem Problem with the login and/or password prompt," " raised Exception ConsoleSettings but continuing") @@ -1688,14 +1688,14 @@ def setup_term(self, system, pty, ssh_obj=None, block=0): # Ctrl-L may cause a esc[J (erase) character to appear in the buffer. # Include this in the patterns that expect $ (end of line) rc = pty.expect(['login: (\x1b\[J)*$', ".*#(\x1b\[J)*$", ".*# (\x1b\[J)*$", ".*\$(\x1b\[J)*", - "~>(\x1b\[J)", "~ #(\x1b\[J)", 'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=10) + "~>(\x1b\[J)", "~ #(\x1b\[J)", ":~(\x1b\[J)", 'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=10) if rc == 0: track_obj.PS1_set, track_obj.LOGIN_set = self.get_login( system_obj.cv_HOST, term_obj, pty, self.build_prompt(system_obj.prompt)) track_obj.PS1_set, track_obj.SUDO_set = self.get_sudo( system_obj.cv_HOST, term_obj, pty, self.build_prompt(system_obj.prompt)) return - if rc in [1, 2, 3, 4, 5]: + if rc in [1, 2, 3, 4, 5, 6]: track_obj.LOGIN_set = track_obj.PS1_set = self.set_PS1( term_obj, pty, self.build_prompt(system_obj.prompt)) track_obj.PS1_set, track_obj.SUDO_set = self.get_sudo( From 6d3e7c823984219e2b114103e7365067a60feebd Mon Sep 17 00:00:00 2001 From: Praveen K Pandey Date: Thu, 16 May 2024 16:45:24 +0530 Subject: [PATCH 6/6] Fixed regression in op-test due to recent commit Fixed regression in op-test due to recent commit Reported-by: Misbah Anjum N Signed-off-by: Praveen K Pandey --- common/OpTestHMC.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/OpTestHMC.py b/common/OpTestHMC.py index 49408f86..292647f7 100644 --- a/common/OpTestHMC.py +++ b/common/OpTestHMC.py @@ -880,8 +880,8 @@ def hmc_perfcollect_configure(self, enable=True): Enable/Disable perfcollection from HMC The value for enabling perfcollection is 1, and for disabling it is 0. ''' - - cmd = ('chsyscfg -r lpar -m %s -i "name=%s, allow_perf_collection=' % + + cmd = ('chsyscfg -r lpar -m %s -i "name=%s, allow_perf_collection=' % (self.mg_system, self.lpar_name)) if enable: cmd = '%s1"' % cmd