Skip to content

Commit b0ffcc2

Browse files
Merge pull request #813 from shirishaganta1/ded-memory
MachineConfig.py:Add support for max memory to available memory of CEC
2 parents 499ccba + c32ab64 commit b0ffcc2

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

common/OpTestHMC.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,8 @@ def get_drc_index_for_ioslot(self, ioslot):
398398
drc_index_out = [line for line in drc_index_out if ioslot+":" in line]
399399
return drc_index_out[0].split(":")[0] if drc_index_out is not None else None
400400

401-
def change_proc_mode(self, proc_mode, sharing_mode, min_proc_units, desired_proc_units, max_proc_units, overcommit_ratio=1):
401+
def change_proc_mode(self, proc_mode, sharing_mode, min_proc_units, desired_proc_units, max_proc_units,
402+
min_memory, desired_memory, max_memory, overcommit_ratio=1):
402403
'''
403404
Sets processor mode to shared or dedicated based on proc_mode
404405
@@ -416,8 +417,10 @@ def change_proc_mode(self, proc_mode, sharing_mode, min_proc_units, desired_proc
416417
overcommit_ratio*int(min_proc_units), overcommit_ratio*int(desired_proc_units),
417418
overcommit_ratio*int(max_proc_units)))
418419
elif proc_mode == 'ded':
419-
self.set_lpar_cfg("proc_mode=ded,sharing_mode=%s,min_procs=%s,max_procs=%s,desired_procs=%s" %
420-
(sharing_mode, min_proc_units, max_proc_units, desired_proc_units))
420+
self.set_lpar_cfg("proc_mode=ded,sharing_mode=%s,min_procs=%s,max_procs=%s,desired_procs=%s,"
421+
"min_mem=%s,desired_mem=%s,max_mem=%s" %
422+
(sharing_mode, min_proc_units, max_proc_units, desired_proc_units,
423+
min_memory, desired_memory, max_memory))
421424
else:
422425
log.info("Please pass valid proc_mode, \"shared\" or \"ded\"")
423426

testcases/MachineConfig.py

+16-16
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,9 @@ def LparSetup(self):
196196
except AttributeError:
197197
self.overcommit_ratio = 1
198198
proc_mode = 'shared'
199-
curr_proc_mode = self.cv_HMC.get_proc_mode()
200-
if proc_mode in curr_proc_mode:
201-
log.info("System is already booted in shared mode.")
202-
else:
203-
self.cv_HMC.profile_bckup()
204-
self.cv_HMC.change_proc_mode(proc_mode, self.sharing_mode, self.min_proc_units,
205-
self.desired_proc_units, self.max_proc_units, self.overcommit_ratio)
206-
199+
self.cv_HMC.profile_bckup()
200+
self.cv_HMC.change_proc_mode(proc_mode, self.sharing_mode, self.min_proc_units,
201+
self.desired_proc_units, self.max_proc_units, self.overcommit_ratio)
207202
'''
208203
If cpu=dedicated is passed in machine_config lpar proc mode changes to dedicated mode.
209204
Pass sharing_mode, min_proc_units, max_proc_units and desired_proc_units in config file.
@@ -228,15 +223,20 @@ def LparSetup(self):
228223
try: self.max_proc_units = conf.args.max_proc_units
229224
except AttributeError:
230225
self.max_proc_units = int(float(self.cv_HMC.get_available_proc_resources()[0]))
226+
try: self.min_memory = conf.args.min_memory
227+
except AttributeError:
228+
self.min_memory = "4096"
229+
try: self.desired_memory = conf.args.desired_memory
230+
except AttributeError:
231+
self.desired_memory = "40960"
232+
try: self.max_memory = conf.args.max_memory
233+
except AttributeError:
234+
self.max_memory = self.cv_HMC.get_available_mem_resources()[0]
231235
proc_mode = 'ded'
232-
curr_proc_mode = self.cv_HMC.get_proc_mode()
233-
if proc_mode in curr_proc_mode:
234-
log.info("System is already booted in dedicated mode.")
235-
else:
236-
self.cv_HMC.profile_bckup()
237-
self.cv_HMC.change_proc_mode(proc_mode, self.sharing_mode, self.min_proc_units,
238-
self.desired_proc_units, self.max_proc_units)
239-
236+
self.cv_HMC.profile_bckup()
237+
self.cv_HMC.change_proc_mode(proc_mode, self.sharing_mode, self.min_proc_units,
238+
self.desired_proc_units, self.max_proc_units,
239+
self.min_memory, self.desired_memory, self.max_memory)
240240

241241
if "vtpm=1" in self.machine_config:
242242
conf = OpTestConfiguration.conf

0 commit comments

Comments
 (0)