Skip to content

Commit 0a4cc62

Browse files
authored
Merge pull request #839 from PraveenPenguin/fix_perf1
Fix perf
2 parents 417e57e + f4fa4a1 commit 0a4cc62

File tree

2 files changed

+41
-4
lines changed

2 files changed

+41
-4
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
'''

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)