diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_limits.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_limits.html
index 587888a2b0..dae4fcbe86 100644
--- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_limits.html
+++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_limits.html
@@ -16,8 +16,8 @@
{% block head %}{% trans "Volume Limits" %}{% endblock %}
-
{% trans "Total Gigabytes" %} ({% block gigabytes_used %}{{ usages.gigabytesUsed|intcomma }}{% endblock %} {% trans "GB" %})
-
{{ usages.maxTotalVolumeGigabytes|intcomma|quota:_("GB") }}
+
{% trans "Total Gibibytes" %} ({% block gigabytes_used %}{{ usages.gigabytesUsed|intcomma }}{% endblock %} {% trans "GiB" %})
+
{{ usages.maxTotalVolumeGigabytes|intcomma|quota:_("GiB") }}
diff --git a/openstack_dashboard/dashboards/project/volumes/volumes/forms.py b/openstack_dashboard/dashboards/project/volumes/volumes/forms.py
index 6125c2ecbc..171b6bf084 100644
--- a/openstack_dashboard/dashboards/project/volumes/volumes/forms.py
+++ b/openstack_dashboard/dashboards/project/volumes/volumes/forms.py
@@ -17,8 +17,6 @@
Views for managing volumes.
"""
-from oslo_utils import units
-
from django.conf import settings
from django.core.urlresolvers import reverse
from django.forms import ValidationError # noqa
@@ -92,7 +90,7 @@ class CreateForm(forms.SelfHandlingForm):
widget=forms.SelectWidget(
attrs={'class': 'snapshot-selector'},
data_attrs=('size', 'name'),
- transform=lambda x: "%s (%sGB)" % (x.name, x.size)),
+ transform=lambda x: "%s (%s GiB)" % (x.name, x.size)),
required=False)
image_source = forms.ChoiceField(
label=_("Use image as a source"),
@@ -106,8 +104,7 @@ class CreateForm(forms.SelfHandlingForm):
widget=forms.SelectWidget(
attrs={'class': 'image-selector'},
data_attrs=('size', 'name'),
- transform=lambda x: "%s (%s)" % (
- x.name, filesizeformat(x.size * units.Gi))),
+ transform=lambda x: "%s (%s GiB)" % (x.name, x.size)),
required=False)
type = forms.ChoiceField(
label=_("Type"),
@@ -117,7 +114,7 @@ class CreateForm(forms.SelfHandlingForm):
'data-switch-on': 'source',
'data-source-no_source_type': _('Type'),
'data-source-image_source': _('Type')}))
- size = forms.IntegerField(min_value=1, initial=1, label=_("Size (GB)"))
+ size = forms.IntegerField(min_value=1, initial=1, label=_("Size (GiB)"))
availability_zone = forms.ChoiceField(
label=_("Availability Zone"),
required=False,
@@ -144,7 +141,7 @@ class CreateForm(forms.SelfHandlingForm):
pass
self.fields['size'].help_text = (
_('Volume size must be equal to or greater than the '
- 'snapshot size (%sGB)') % snapshot.size)
+ 'snapshot size (%sGiB)') % snapshot.size)
del self.fields['image_source']
del self.fields['volume_source']
del self.fields['volume_source_type']
@@ -173,7 +170,7 @@ class CreateForm(forms.SelfHandlingForm):
min_vol_size = min_disk_size
size_help_text = (_('Volume size must be equal to or '
'greater than the image minimum '
- 'disk size (%sGB)')
+ 'disk size (%sGiB)')
% min_disk_size)
self.fields['size'].initial = min_vol_size
self.fields['size'].help_text = size_help_text
@@ -200,8 +197,8 @@ class CreateForm(forms.SelfHandlingForm):
self.fields['description'].initial = volume.description
min_vol_size = volume.size
size_help_text = (_('Volume size must be equal to or greater '
- 'than the origin volume size (%s)')
- % filesizeformat(volume.size))
+ 'than the origin volume size (%sGiB)')
+ % volume.size)
self.fields['size'].initial = min_vol_size
self.fields['size'].help_text = size_help_text
self.fields['volume_source'].choices = ((volume.id, volume),)
@@ -330,7 +327,7 @@ class CreateForm(forms.SelfHandlingForm):
snapshot_id = snapshot.id
if (data['size'] < snapshot.size):
error_message = (_('The volume size cannot be less than '
- 'the snapshot size (%sGB)')
+ 'the snapshot size (%sGiB)')
% snapshot.size)
raise ValidationError(error_message)
az = None
@@ -351,7 +348,7 @@ class CreateForm(forms.SelfHandlingForm):
properties.get('min_disk', 0))
if (min_disk_size > 0 and data['size'] < min_disk_size):
error_message = (_('The volume size cannot be less than '
- 'the image minimum disk size (%sGB)')
+ 'the image minimum disk size (%sGiB)')
% min_disk_size)
raise ValidationError(error_message)
elif (data.get("volume_source", None) and
@@ -362,7 +359,7 @@ class CreateForm(forms.SelfHandlingForm):
if data['size'] < volume.size:
error_message = (_('The volume size cannot be less than '
- 'the source volume size (%sGB)')
+ 'the source volume size (%sGiB)')
% volume.size)
raise ValidationError(error_message)
else:
@@ -370,9 +367,9 @@ class CreateForm(forms.SelfHandlingForm):
data['size'] = int(data['size'])
if availableGB < data['size']:
- error_message = _('A volume of %(req)iGB cannot be created as '
- 'you only have %(avail)iGB of your quota '
- 'available.')
+ error_message = _('A volume of %(req)iGiB cannot be created '
+ 'as you only have %(avail)iGiB of your '
+ 'quota available.')
params = {'req': data['size'],
'avail': availableGB}
raise ValidationError(error_message % params)
@@ -707,11 +704,11 @@ class ExtendForm(forms.SelfHandlingForm):
required=False,
)
orig_size = forms.IntegerField(
- label=_("Current Size (GB)"),
+ label=_("Current Size (GiB)"),
widget=forms.TextInput(attrs={'readonly': 'readonly'}),
required=False,
)
- new_size = forms.IntegerField(label=_("New Size (GB)"))
+ new_size = forms.IntegerField(label=_("New Size (GiB)"))
def clean(self):
cleaned_data = super(ExtendForm, self).clean()
@@ -726,8 +723,8 @@ class ExtendForm(forms.SelfHandlingForm):
availableGB = usages['maxTotalVolumeGigabytes'] - \
usages['gigabytesUsed']
if availableGB < (new_size - orig_size):
- message = _('Volume cannot be extended to %(req)iGB as '
- 'you only have %(avail)iGB of your quota '
+ message = _('Volume cannot be extended to %(req)iGiB as '
+ 'you only have %(avail)iGiB of your quota '
'available.')
params = {'req': new_size, 'avail': availableGB}
self._errors["new_size"] = self.error_class([message % params])
diff --git a/openstack_dashboard/dashboards/project/volumes/volumes/tables.py b/openstack_dashboard/dashboards/project/volumes/volumes/tables.py
index cd6b62b0dc..756e8dd574 100644
--- a/openstack_dashboard/dashboards/project/volumes/volumes/tables.py
+++ b/openstack_dashboard/dashboards/project/volumes/volumes/tables.py
@@ -303,7 +303,7 @@ class UpdateRow(tables.Row):
def get_size(volume):
- return _("%sGB") % volume.size
+ return _("%sGiB") % volume.size
def get_attachment_name(request, attachment):
diff --git a/openstack_dashboard/dashboards/project/volumes/volumes/tests.py b/openstack_dashboard/dashboards/project/volumes/volumes/tests.py
index b6a70d0554..219baf80a9 100644
--- a/openstack_dashboard/dashboards/project/volumes/volumes/tests.py
+++ b/openstack_dashboard/dashboards/project/volumes/volumes/tests.py
@@ -494,7 +494,7 @@ class VolumeViewTests(test.TestCase):
self.assertEqual(res.redirect_chain, [])
self.assertFormError(res, 'form', None,
"The volume size cannot be less than the "
- "snapshot size (40GB)")
+ "snapshot size (40GiB)")
@test.create_stubs({cinder: ('volume_create',
'volume_type_list',
@@ -725,7 +725,7 @@ class VolumeViewTests(test.TestCase):
self.assertEqual(res.redirect_chain, [])
self.assertFormError(res, 'form', None,
"The volume size cannot be less than the "
- "image minimum disk size (30GB)")
+ "image minimum disk size (30GiB)")
def test_create_volume_from_image_under_image_min_disk_size(self):
image = self.images.get(name="protected_images")
@@ -791,8 +791,8 @@ class VolumeViewTests(test.TestCase):
url = reverse('horizon:project:volumes:volumes:create')
res = self.client.post(url, formData)
- expected_error = [u'A volume of 5000GB cannot be created as you only'
- ' have 20GB of your quota available.']
+ expected_error = [u'A volume of 5000GiB cannot be created as you only'
+ ' have 20GiB of your quota available.']
self.assertEqual(res.context['form'].errors['__all__'], expected_error)
@test.create_stubs({cinder: ('volume_snapshot_list',
@@ -1578,8 +1578,8 @@ class VolumeViewTests(test.TestCase):
args=[volume.id])
res = self.client.post(url, formData)
self.assertFormError(res, "form", "new_size",
- "Volume cannot be extended to 1000GB as you only "
- "have 80GB of your quota available.")
+ "Volume cannot be extended to 1000GiB as you "
+ "only have 80GiB of your quota available.")
@test.create_stubs({cinder: ('volume_backup_supported',
'volume_list',
diff --git a/releasenotes/notes/gb-to-gib-conversion-8a91839030a2f570.yaml b/releasenotes/notes/gb-to-gib-conversion-8a91839030a2f570.yaml
new file mode 100644
index 0000000000..9bb41fc5ee
--- /dev/null
+++ b/releasenotes/notes/gb-to-gib-conversion-8a91839030a2f570.yaml
@@ -0,0 +1,12 @@
+---
+prelude: >
+ Cinder defines storage size in gibibytes (GiB), which is inconsistent with Horizon panels that
+ show/request storage size in gigabytes (GB).
+features:
+ - All Volume related panels in Horizon that previously used the term "GB" and "gigabyte" have been
+ replaced with 'GiB' and 'gibibyte'.
+issues:
+ - There are also some Nova related panels (e.g. "Instances") that reference storage size in "GB".
+ These panels will be addressed in subsequent patches.
+fixes:
+ - blueprint gb-to-gib-conversion
\ No newline at end of file