Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perf config #832

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions common/OpTestHMC.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@ 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
'''
abdhaleegit marked this conversation as resolved.
Show resolved Hide resolved
# Set Secure Boot value using HMC command
cmd = ('chsyscfg -r lpar -m %s -i "name=%s, secure_boot=' %
Expand Down Expand Up @@ -914,6 +911,33 @@ def run_command(self, i_cmd, timeout=60):
:param timeout: number, time out in seconds
'''
return self.ssh.run_command(i_cmd, timeout)

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
enable perfcollection value is 1 and for disable it 0
'''
# Set perf collection profile value using HMC command
cmd = ('chsyscfg -r lpar -m %s -i "name=%s, allow_perf_collection=' %
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is only one double qoute .. is this a typo ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes that is correct

2024-05-08 14:52:29,484:op-test.common.OpTestHMC:wait_lpar_state:INFO:Current state: Shutting Down
[console-expect]#lssyscfg -m system -r lpar --filter lpar_names=system-lp13-CR -F state
lssyscfg -m system -r lpar --filter lpar_names=system-lp13-CR -F state
Not Activated
[console-expect]#echo $?
echo $?
0
[console-expect]#lsrefcode -m system -r lpar --filter lpar_names=system-lp13-CR -F refcode
lsrefcode -m system -r lpar --filter lpar_names=system-lp13-CR -F refcode
00000000
[console-expect]#echo $?
echo $?
0
2024-05-08 14:52:44,765:op-test.common.OpTestHMC:wait_lpar_state:INFO:Current state: Not Activated
[console-expect]#lssyscfg -m system -r lpar --filter lpar_names=system-lp13-CR -F allow_perf_collection
lssyscfg -m system -r lpar --filter lpar_names=system-lp13-CR -F allow_perf_collection
1
[console-expect]#echo $?
echo $?
0
2024-05-08 14:52:59,910:op-test.testcases.MachineConfig:LparSetup:INFO:System is already booted with perf collection profile enabled
[console-expect]#lssyscfg -m system -r lpar --filter lpar_names=system-lp13-CR -F state
lssyscfg -m system -r lpar --filter lpar_names=system-lp13-CR -F state
Not Activated
[console-expect]#echo $?
echo $?
0
[console-expect]#lsrefcode -m system -r lpar --filter lpar_names=system-lp13-CR -F refcode
lsrefcode -m system -r lpar --filter lpar_names=system-lp13-CR -F refcode
00000000
[console-expect]#echo $?
echo $?
0
[console-expect]#lssyscfg -m system -r lpar --filter lpar_names=system-lp13-CR -F state
lssyscfg -m system -r lpar --filter lpar_names=system-lp13-CR -F state
Not Activated
[console-expect]#echo $?

(self.mg_system, self.lpar_name))
if enable:
cmd = '%s1"' % cmd
else:
cmd = '%s0"' % cmd
self.run_command(cmd, timeout=300)


class OpTestHMC(HMCUtil):
Expand Down
16 changes: 14 additions & 2 deletions testcases/MachineConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ def callConfig(self, key):
class LparConfig():

'''
pass machine_config in config file indicating proc mode, vtpm and vpmem.
pass machine_config in config file indicating proc mode, vtpm vpmem and perf.
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,
lpar_name=None, lpar_prof=None, machin_config =None, sb_enable=None):
Expand Down Expand Up @@ -325,6 +325,18 @@ def LparSetup(self):
ioslot_drc_names = ",".join(ioslot_drc_names[:ioslot_drc_names.index("=")].split(",")[:-1]) \
if "=" in ioslot_drc_names else ioslot_drc_names
self.cv_HMC.add_ioslot(ioslot_drc_names)

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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better message will be
"Performance Information collection is already enabled"
or
"Performance Information Collection is active"

else:
self.cv_HMC.hmc_perfcollect_configure()
if self.cv_HMC.is_perfcollection_enabled:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since hmc_perfcollect_configure() returns a value, why not add a check for the same and avoid calling is_percollection_enabled() twice?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks sachin , earlier logic was not up to mark in OptestHMC.py to return so removed return statement from hmc_perfcollect_configure() , now we are good that calling is_percollection_enabled() return exact check

log.info("System is already booted with perf collection profile enabled")
else:
return "Failed to enable Performance Information collection"


if self.sb_enable is not None :
self.cv_HMC.hmc_secureboot_on_off(self.sb_enable)
Expand Down