load knob range

This commit is contained in:
yangdsh 2020-03-28 00:34:36 +00:00 committed by Dana Van Aken
parent b4e5fb2e66
commit 0461610ebd
2 changed files with 11 additions and 5 deletions

View File

@ -252,7 +252,9 @@ class SessionKnobManager(models.Manager):
@staticmethod
def get_knob_min_max_tunability(session, tunable_only=False):
# Returns a dict of the knob
# This method returns only min, max, and tunability of session knobs
# It is only used in the manage command 'dumpknob'
# It is deprecated. We should use function get_knobs_for_session(session)
filter_args = dict(session=session)
if tunable_only:
filter_args['tunable'] = True
@ -274,8 +276,11 @@ class SessionKnobManager(models.Manager):
for lower_name, session_knob in session_knobs.items():
if lower_name in knob_dicts:
settings = knob_dicts[lower_name]
if "minval" in settings:
session_knob.minval = settings["minval"]
if "maxval" in settings:
session_knob.maxval = settings["maxval"]
if "tunable" in settings:
session_knob.tunable = settings["tunable"]
if "upperbound" in settings:
session_knob.upperbound = settings["upperbound"]

View File

@ -1591,7 +1591,8 @@ def alt_create_or_edit_session(request):
sk = SessionKnob.objects.get_knobs_for_session(session)
sess_knobs = {}
for knob in sk:
sess_knobs[knob['name']] = {x: knob[x] for x in ('minval', 'maxval', 'tunable')}
sess_knobs[knob['name']] = {x: knob[x] for x in ('minval', 'maxval', 'tunable',
'upperbound', 'lowerbound')}
res['session_knobs'] = sess_knobs
if warnings: