Rename max_cpu_frequency references

Change [1] renamed some host attributes. Therefore, we need to update
the GUI to reference the correct attributes.

Story: 2009886
Task: 45522

[1] https://review.opendev.org/c/starlingx/config/+/843661

Test plan:
   Change worker max_cpu_mhz_configured from GUI.

Signed-off-by: Iago Estrela <IagoFilipe.EstrelaBarros@windriver.com>
Change-Id: I20af495c1c6835ee781ce805cfb902e2b397cc7d
This commit is contained in:
Iago Estrela 2022-06-02 00:27:02 -03:00
parent d7f8e4ca8c
commit c41634c10b
5 changed files with 19 additions and 17 deletions

View File

@ -63,7 +63,7 @@ openstackdocs_auto_name = False
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = 'en'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.

View File

@ -850,7 +850,8 @@ class Host(base.APIResourceWrapper):
'requires_reboot', 'boot_device', 'rootfs_device',
'install_output', 'console', 'ttys_dcd', 'patch_state',
'allow_insvc_patching', 'install_state', 'install_state_info',
'clock_synchronization', 'max_cpu_frequency', 'max_cpu_default']
'clock_synchronization', 'max_cpu_mhz_configured',
'max_cpu_mhz_allowed']
PERSONALITY_DISPLAY_CHOICES = (
(PERSONALITY_CONTROLLER, _("Controller")),

View File

@ -13,9 +13,9 @@
<dd>{{ host.hyperthreading }}</dd>
{% if host.personality == 'Worker' %}
<dt>{% trans "Max CPU Frequency " %}</dt>
<dd>{{ host.max_cpu_frequency }}</dd>
<dd>{{ host.max_cpu_mhz_configured }}</dd>
<dt>{% trans "Max CPU Default " %}</dt>
<dd>{{ host.max_cpu_default }}</dd>
<dd>{{ host.max_cpu_mhz_allowed }}</dd>
{% endif %}
</dl>
<div id="cpufunctions">

View File

@ -81,7 +81,7 @@ class UpdateView(workflows.WorkflowView):
'bm_username': host.bm_username,
'ttys_dcd': host.ttys_dcd,
'clock_synchronization': host.clock_synchronization,
'max_cpu_frequency': host.max_cpu_frequency}
'max_cpu_mhz_configured': host.max_cpu_mhz_configured}
class DetailView(tabs.TabbedTableView):

View File

@ -55,8 +55,8 @@ BM_TYPES_CHOICES = (
(sysinv.HOST_BM_TYPE_REDFISH, _("Redfish")),
)
MAX_CPU_FREQUENCY_CHOICES = (
('max_cpu_default', _("Default")),
MAX_CPU_MHZ_CONFIGURED_CHOICES = (
('max_cpu_mhz_allowed', _("Default")),
('custom', _("Custom")),
)
@ -178,8 +178,8 @@ class UpdateHostInfoAction(workflows.Action):
cpu_freq_config = forms.ChoiceField(
label=_("CPU Frequency Configuration"),
required=True,
initial='max_cpu_default',
choices=MAX_CPU_FREQUENCY_CHOICES,
initial='max_cpu_mhz_allowed',
choices=MAX_CPU_MHZ_CONFIGURED_CHOICES,
widget=forms.Select(
attrs={
'class': 'switchable switched',
@ -188,7 +188,7 @@ class UpdateHostInfoAction(workflows.Action):
_("CPU Frequency Configuration"),
'data-slug': 'cpu_freq_config'}))
max_cpu_frequency = forms.IntegerField(
max_cpu_mhz_configured = forms.IntegerField(
label=_("Max CPU Frequency (MHz)"),
initial=1,
min_value=1,
@ -263,8 +263,9 @@ class UpdateHostInfoAction(workflows.Action):
'readonly'
self.fields['cpu_freq_config'].required = False
if (self.initial['max_cpu_frequency'] is not None and
self.initial['max_cpu_frequency'] != host.max_cpu_default):
if (self.initial['max_cpu_mhz_configured'] is not None and
self.initial['max_cpu_mhz_configured'] !=
host.max_cpu_mhz_allowed):
self.fields['cpu_freq_config'].initial = 'custom'
def clean_location(self):
@ -282,8 +283,8 @@ class UpdateHostInfoAction(workflows.Action):
def clean(self):
cleaned_data = super(UpdateHostInfoAction, self).clean()
if cleaned_data['cpu_freq_config'] == 'max_cpu_default':
cleaned_data['max_cpu_frequency'] = 'max_cpu_default'
if cleaned_data['cpu_freq_config'] == 'max_cpu_mhz_allowed':
cleaned_data['max_cpu_mhz_configured'] = 'max_cpu_mhz_allowed'
disabled = self.fields['personality'].widget.attrs.get('disabled')
if disabled == 'disabled':
@ -308,8 +309,8 @@ class UpdateHostInfoAction(workflows.Action):
def handle(self, request, data):
host_id = self.initial['host_id']
try:
max_cpu_frequency = data['max_cpu_frequency']
patch = {'max_cpu_frequency': max_cpu_frequency}
max_cpu_mhz_configured = data['max_cpu_mhz_configured']
patch = {'max_cpu_mhz_configured': max_cpu_mhz_configured}
stx_api.sysinv.host_update(request, host_id, **patch)
except exc.ClientException as ce:
LOG.error(ce)
@ -340,7 +341,7 @@ class UpdateHostInfo(workflows.Step):
"location",
"ttys_dcd",
"clock_synchronization",
"max_cpu_frequency")
"max_cpu_mhz_configured")
class UpdateInstallParamsAction(workflows.Action):