Skip to content

Commit

Permalink
Merge branch 'open-power:master' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
mahi657 authored May 20, 2024
2 parents de9f77e + 6d3e7c8 commit 822038e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 10 deletions.
32 changes: 29 additions & 3 deletions common/OpTestHMC.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=' %
Expand Down Expand Up @@ -863,6 +861,34 @@ 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 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):
'''
Expand Down
12 changes: 6 additions & 6 deletions common/OpTestUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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(
Expand Down
13 changes: 12 additions & 1 deletion testcases/MachineConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 822038e

Please sign in to comment.