diff --git a/common/OpTestHMC.py b/common/OpTestHMC.py index de947375..49408f86 100644 --- a/common/OpTestHMC.py +++ b/common/OpTestHMC.py @@ -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=' % @@ -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): ''' diff --git a/testcases/MachineConfig.py b/testcases/MachineConfig.py index 61d4afaf..10bf00b6 100755 --- a/testcases/MachineConfig.py +++ b/testcases/MachineConfig.py @@ -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, @@ -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()