From 281bcabe48b3c7593be522bb5212b4101220827e Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Tue, 2 Oct 2018 10:18:40 -0400 Subject: [PATCH] Fix Journal Size in Assign Storage Function Popup The Horizon "Assign Storage Function" popup displays "Journal Size" in MiB instead of GiB. The equivalent CLI commands display the journal size as GiB. Change-Id: Ia0151904813e8a42eb8971dbeb5d3f716c1b5678 Closes-Bug: 1792194 Signed-off-by: Wei Zhou --- starlingx-dashboard/centos/build_srpm.data | 2 +- .../starlingx_dashboard/api/sysinv.py | 6 +++--- .../dashboards/admin/inventory/storages/forms.py | 16 +++++++++------- .../inventory/storages/_editstoragevolume.html | 4 ++-- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/starlingx-dashboard/centos/build_srpm.data b/starlingx-dashboard/centos/build_srpm.data index cb45a03a..523e66bd 100644 --- a/starlingx-dashboard/centos/build_srpm.data +++ b/starlingx-dashboard/centos/build_srpm.data @@ -1,2 +1,2 @@ SRC_DIR="starlingx-dashboard" -TIS_PATCH_VER=13 +TIS_PATCH_VER=14 diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/api/sysinv.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/api/sysinv.py index b87f9ae2..32061ee3 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/api/sysinv.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/api/sysinv.py @@ -97,9 +97,9 @@ USER_PARTITION_PHYS_VOL = constants.USER_PARTITION_PHYSICAL_VOLUME PARTITION_STATUS_MSG = constants.PARTITION_STATUS_MSG PARTITION_IN_USE_STATUS = constants.PARTITION_IN_USE_STATUS -# The default size of a stor's journal. This should be the same value as -# journal_default_size from sysinv.conf. -JOURNAL_DEFAULT_SIZE = 1024 +# The default size of a stor's journal in GB. This should be the +# same value as journal_default_size from sysinv.conf. +JOURNAL_DEFAULT_SIZE = 1 # Platform configuration PLATFORM_CONFIGURATION = '/etc/platform/platform.conf' diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/storages/forms.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/storages/forms.py index 8fb333bf..71d2f550 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/storages/forms.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/storages/forms.py @@ -72,11 +72,11 @@ class EditStorageVolume(forms.SelfHandlingForm): help_text=_("Assign disk to journal " "storage volume.")) - journal_size_mib = forms.CharField(label=_("Journal Size MiB"), + journal_size_gib = forms.CharField(label=_("Journal Size GiB"), required=False, initial=stx_api.sysinv.JOURNAL_DEFAULT_SIZE, widget=forms.TextInput(attrs={ - 'data-slug': 'journal_size_mib'}), + 'data-slug': 'journal_size_gib'}), help_text=_("Journal's size for the " "current OSD.")) @@ -127,10 +127,11 @@ class EditStorageVolume(forms.SelfHandlingForm): data['journal_location'] = journal else: data['journal_location'] = None - data['journal_size_mib'] = stx_api.sysinv.JOURNAL_DEFAULT_SIZE + data['journal_size_mib'] = stx_api.sysinv.JOURNAL_DEFAULT_SIZE * 1024 del data['journal_locations'] del data['id'] + del data['journal_size_gib'] # The REST API takes care of updating the stor journal information. stor = stx_api.sysinv.host_stor_update(request, stor_id, **data) @@ -215,14 +216,14 @@ class AddStorageVolume(forms.SelfHandlingForm): "journal storage " "volume.")) - journal_size_mib = forms.CharField(label=_("Journal Size MiB"), + journal_size_gib = forms.CharField(label=_("Journal Size GiB"), required=False, initial=stx_api.sysinv.JOURNAL_DEFAULT_SIZE, widget=forms.TextInput(attrs={ 'class': 'switched', 'data-switch-on': 'function', 'data-function-osd': - _("Journal Size MiB")}), + _("Journal Size GiB")}), help_text=_("Journal's size for the" "current OSD.")) @@ -285,7 +286,7 @@ class AddStorageVolume(forms.SelfHandlingForm): journal_tuple_list.append((j.uuid, "%s " % j.uuid)) else: journal_tuple_list.append((None, "Collocated with OSD")) - self.fields['journal_size_mib'].widget.attrs['disabled'] = \ + self.fields['journal_size_gib'].widget.attrs['disabled'] = \ 'disabled' self.fields['disks'].choices = disk_tuple_list @@ -320,7 +321,7 @@ class AddStorageVolume(forms.SelfHandlingForm): data['journal_location'] = journal else: data['journal_location'] = None - data['journal_size_mib'] = stx_api.sysinv.JOURNAL_DEFAULT_SIZE + data['journal_size_mib'] = stx_api.sysinv.JOURNAL_DEFAULT_SIZE * 1024 try: del data['host_id'] @@ -328,6 +329,7 @@ class AddStorageVolume(forms.SelfHandlingForm): del data['tiers'] del data['hostname'] del data['journal_locations'] + del data['journal_size_gib'] # The REST API takes care of creating the stor # and updating disk.foristorid diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_editstoragevolume.html b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_editstoragevolume.html index 8ba25997..3d4ef360 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_editstoragevolume.html +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/templates/inventory/storages/_editstoragevolume.html @@ -13,14 +13,14 @@