Skip to content

Commit

Permalink
Merge pull request #839 from PraveenPenguin/fix_perf1
Browse files Browse the repository at this point in the history
Fix perf
  • Loading branch information
abdhaleegit authored May 16, 2024
2 parents 417e57e + f4fa4a1 commit 0a4cc62
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 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
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 0a4cc62

Please sign in to comment.