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 <wei.zhou@windriver.com>
This commit is contained in:
Wei Zhou 2018-10-02 10:18:40 -04:00
parent 42b54d543e
commit 281bcabe48
4 changed files with 15 additions and 13 deletions

View File

@ -1,2 +1,2 @@
SRC_DIR="starlingx-dashboard" SRC_DIR="starlingx-dashboard"
TIS_PATCH_VER=13 TIS_PATCH_VER=14

View File

@ -97,9 +97,9 @@ USER_PARTITION_PHYS_VOL = constants.USER_PARTITION_PHYSICAL_VOLUME
PARTITION_STATUS_MSG = constants.PARTITION_STATUS_MSG PARTITION_STATUS_MSG = constants.PARTITION_STATUS_MSG
PARTITION_IN_USE_STATUS = constants.PARTITION_IN_USE_STATUS PARTITION_IN_USE_STATUS = constants.PARTITION_IN_USE_STATUS
# The default size of a stor's journal. This should be the same value as # The default size of a stor's journal in GB. This should be the
# journal_default_size from sysinv.conf. # same value as journal_default_size from sysinv.conf.
JOURNAL_DEFAULT_SIZE = 1024 JOURNAL_DEFAULT_SIZE = 1
# Platform configuration # Platform configuration
PLATFORM_CONFIGURATION = '/etc/platform/platform.conf' PLATFORM_CONFIGURATION = '/etc/platform/platform.conf'

View File

@ -72,11 +72,11 @@ class EditStorageVolume(forms.SelfHandlingForm):
help_text=_("Assign disk to journal " help_text=_("Assign disk to journal "
"storage volume.")) "storage volume."))
journal_size_mib = forms.CharField(label=_("Journal Size MiB"), journal_size_gib = forms.CharField(label=_("Journal Size GiB"),
required=False, required=False,
initial=stx_api.sysinv.JOURNAL_DEFAULT_SIZE, initial=stx_api.sysinv.JOURNAL_DEFAULT_SIZE,
widget=forms.TextInput(attrs={ widget=forms.TextInput(attrs={
'data-slug': 'journal_size_mib'}), 'data-slug': 'journal_size_gib'}),
help_text=_("Journal's size for the " help_text=_("Journal's size for the "
"current OSD.")) "current OSD."))
@ -127,10 +127,11 @@ class EditStorageVolume(forms.SelfHandlingForm):
data['journal_location'] = journal data['journal_location'] = journal
else: else:
data['journal_location'] = None 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['journal_locations']
del data['id'] del data['id']
del data['journal_size_gib']
# The REST API takes care of updating the stor journal information. # The REST API takes care of updating the stor journal information.
stor = stx_api.sysinv.host_stor_update(request, stor_id, **data) stor = stx_api.sysinv.host_stor_update(request, stor_id, **data)
@ -215,14 +216,14 @@ class AddStorageVolume(forms.SelfHandlingForm):
"journal storage " "journal storage "
"volume.")) "volume."))
journal_size_mib = forms.CharField(label=_("Journal Size MiB"), journal_size_gib = forms.CharField(label=_("Journal Size GiB"),
required=False, required=False,
initial=stx_api.sysinv.JOURNAL_DEFAULT_SIZE, initial=stx_api.sysinv.JOURNAL_DEFAULT_SIZE,
widget=forms.TextInput(attrs={ widget=forms.TextInput(attrs={
'class': 'switched', 'class': 'switched',
'data-switch-on': 'function', 'data-switch-on': 'function',
'data-function-osd': 'data-function-osd':
_("Journal Size MiB")}), _("Journal Size GiB")}),
help_text=_("Journal's size for the" help_text=_("Journal's size for the"
"current OSD.")) "current OSD."))
@ -285,7 +286,7 @@ class AddStorageVolume(forms.SelfHandlingForm):
journal_tuple_list.append((j.uuid, "%s " % j.uuid)) journal_tuple_list.append((j.uuid, "%s " % j.uuid))
else: else:
journal_tuple_list.append((None, "Collocated with OSD")) 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' 'disabled'
self.fields['disks'].choices = disk_tuple_list self.fields['disks'].choices = disk_tuple_list
@ -320,7 +321,7 @@ class AddStorageVolume(forms.SelfHandlingForm):
data['journal_location'] = journal data['journal_location'] = journal
else: else:
data['journal_location'] = None 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: try:
del data['host_id'] del data['host_id']
@ -328,6 +329,7 @@ class AddStorageVolume(forms.SelfHandlingForm):
del data['tiers'] del data['tiers']
del data['hostname'] del data['hostname']
del data['journal_locations'] del data['journal_locations']
del data['journal_size_gib']
# The REST API takes care of creating the stor # The REST API takes care of creating the stor
# and updating disk.foristorid # and updating disk.foristorid

View File

@ -13,14 +13,14 @@
</fieldset> </fieldset>
<script> <script>
/* Obtain the journal elements. */ /* Obtain the journal elements. */
var journal_size_box = document.getElementById("id_journal_size_mib"); var journal_size_box = document.getElementById("id_journal_size_gib");
var journal_locations_dropdown = document.getElementById("id_journal_locations"); var journal_locations_dropdown = document.getElementById("id_journal_locations");
function select_journal_size() { function select_journal_size() {
/* If the chosen journal location is collocated, make the journal /* If the chosen journal location is collocated, make the journal
size textbox readonly. */ size textbox readonly. */
if (journal_locations_dropdown[journal_locations_dropdown.selectedIndex].text === "Collocated with OSD") { if (journal_locations_dropdown[journal_locations_dropdown.selectedIndex].text === "Collocated with OSD") {
journal_size_box.value = "1024" journal_size_box.value = "1"
journal_size_box.readOnly = true journal_size_box.readOnly = true
} }
else else