Skip to content

Commit 02376f5

Browse files
authored
Merge branch 'open-power:master' into test
2 parents b746f14 + 6d3e7c8 commit 02376f5

File tree

3 files changed

+47
-10
lines changed

3 files changed

+47
-10
lines changed

common/OpTestHMC.py

+29-3
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,7 @@ def check_lpar_secureboot_state(self, hmc_con):
180180
def hmc_secureboot_on_off(self, enable=True):
181181
'''
182182
Enable/Disable Secure Boot from HMC
183-
1. PowerOFF/Shutdown LPAR from HMC
184-
2. Enable/Disable Secure boot using 'chsyscfg' command
185-
3. PowerON/Activate the LPAR and boot to Operating System
183+
Enable/Disable Secure boot using 'chsyscfg' command
186184
'''
187185
# Set Secure Boot value using HMC command
188186
cmd = ('chsyscfg -r lpar -m %s -i "name=%s, secure_boot=' %
@@ -863,6 +861,34 @@ def is_msp_enabled(self, mg_system, vios_name, remote_hmc=None):
863861
if int(msp_output[0]) != 1:
864862
return False
865863
return True
864+
865+
def is_perfcollection_enabled(self):
866+
'''
867+
Get Performance Information collection allowed in hmc profile
868+
869+
:returns: Ture if allow_perf_collection in hmc otherwise false
870+
'''
871+
872+
rc = self.run_command("lssyscfg -m %s -r lpar --filter lpar_names=%s -F allow_perf_collection"
873+
% (self.mg_system, self.lpar_name))
874+
if rc:
875+
return True
876+
return False
877+
878+
def hmc_perfcollect_configure(self, enable=True):
879+
'''
880+
Enable/Disable perfcollection from HMC
881+
The value for enabling perfcollection is 1, and for disabling it is 0.
882+
'''
883+
884+
cmd = ('chsyscfg -r lpar -m %s -i "name=%s, allow_perf_collection=' %
885+
(self.mg_system, self.lpar_name))
886+
if enable:
887+
cmd = '%s1"' % cmd
888+
else:
889+
cmd = '%s0"' % cmd
890+
self.run_command(cmd, timeout=300)
891+
866892

867893
def gather_logs(self, list_of_commands=[], remote_hmc=None, output_dir=None):
868894
'''

common/OpTestUtil.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1484,9 +1484,9 @@ def get_login(self, host, term_obj, pty, prompt):
14841484
if rc == 0:
14851485
pty.sendline(my_pwd)
14861486
time.sleep(0.5)
1487-
rc = pty.expect(['login: $', ".*#$", ".*# $", ".*\$", "~ #",
1487+
rc = pty.expect(['login: $', ".*#$", ".*# $", ".*\$", "~ #", ":~",
14881488
'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=60)
1489-
if rc not in [1, 2, 3, 4]:
1489+
if rc not in [1, 2, 3, 4, 5]:
14901490
if term_obj.setup_term_quiet == 0:
14911491
log.warning("OpTestSystem Problem with the login and/or password prompt,"
14921492
" raised Exception ConsoleSettings but continuing")
@@ -1518,9 +1518,9 @@ def get_login(self, host, term_obj, pty, prompt):
15181518
if rc == 0:
15191519
pty.sendline(my_pwd)
15201520
time.sleep(0.5)
1521-
rc = pty.expect(['login: $', ".*#$", ".*# $", ".*\$", "~ #",
1521+
rc = pty.expect(['login: $', ".*#$", ".*# $", ".*\$", "~ #", ":~",
15221522
'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=10)
1523-
if rc not in [1, 2, 3, 4]:
1523+
if rc not in [1, 2, 3, 4, 5]:
15241524
if term_obj.setup_term_quiet == 0:
15251525
log.warning("OpTestSystem Problem with the login and/or password prompt,"
15261526
" raised Exception ConsoleSettings but continuing")
@@ -1688,14 +1688,14 @@ def setup_term(self, system, pty, ssh_obj=None, block=0):
16881688
# Ctrl-L may cause a esc[J (erase) character to appear in the buffer.
16891689
# Include this in the patterns that expect $ (end of line)
16901690
rc = pty.expect(['login: (\x1b\[J)*$', ".*#(\x1b\[J)*$", ".*# (\x1b\[J)*$", ".*\$(\x1b\[J)*",
1691-
"~>(\x1b\[J)", "~ #(\x1b\[J)", 'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=10)
1691+
"~>(\x1b\[J)", "~ #(\x1b\[J)", ":~(\x1b\[J)", 'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=10)
16921692
if rc == 0:
16931693
track_obj.PS1_set, track_obj.LOGIN_set = self.get_login(
16941694
system_obj.cv_HOST, term_obj, pty, self.build_prompt(system_obj.prompt))
16951695
track_obj.PS1_set, track_obj.SUDO_set = self.get_sudo(
16961696
system_obj.cv_HOST, term_obj, pty, self.build_prompt(system_obj.prompt))
16971697
return
1698-
if rc in [1, 2, 3, 4, 5]:
1698+
if rc in [1, 2, 3, 4, 5, 6]:
16991699
track_obj.LOGIN_set = track_obj.PS1_set = self.set_PS1(
17001700
term_obj, pty, self.build_prompt(system_obj.prompt))
17011701
track_obj.PS1_set, track_obj.SUDO_set = self.get_sudo(

testcases/MachineConfig.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ class LparConfig():
203203
valid values: cpu=shared or cpu=dedicated
204204
vtpm=1 or vtpm=0
205205
vpmem=0 or vpmem=1
206-
Ex: machine_config="cpu=dedicated,vtpm=1,vpmem=1"
206+
Ex: machine_config="cpu=dedicated,vtpm=1,vpmem=1,perf=1"
207207
'''
208208

209209
def __init__(self, cv_HMC=None, system_name=None,
@@ -421,6 +421,17 @@ def LparSetup(self, lpar_config=""):
421421

422422
if self.sb_enable is not None:
423423
self.cv_HMC.hmc_secureboot_on_off(self.sb_enable)
424+
425+
if "perf=1" in self.machine_config:
426+
conf = OpTestConfiguration.conf
427+
if self.cv_HMC.is_perfcollection_enabled():
428+
log.info("System is already booted with perf collection profile enabled")
429+
else:
430+
self.cv_HMC.hmc_perfcollect_configure()
431+
if self.cv_HMC.is_perfcollection_enabled:
432+
log.info("System is already booted with perf collection profile enabled")
433+
else:
434+
return "Failed to enable Performance Information collection"
424435

425436
self.cv_HMC.poweron_lpar()
426437
curr_proc_mode = self.cv_HMC.get_proc_mode()

0 commit comments

Comments
 (0)