summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Hagarty <richard.hagarty@hpe.com>2015-11-10 16:15:53 -0800
committerRich Hagarty <richard.hagarty@hpe.com>2015-12-11 07:28:42 -0800
commit70ade476b8001ed63cbb371620a035fe1ca7a44a (patch)
treeaadf02b8bc4808aff5b50f089465ea82dfbbe7d2
parentf37f32ad067ff3af3afc98d54f0ad464faf60271 (diff)
downloadhorizon-70ade476b8001ed63cbb371620a035fe1ca7a44a.tar.gz
Use "GiB" and "gibibyte" labels in volume panels
Cinder APIs require size values to be in gibibytes (GiB). Horizon panels show these values in gigabytes (GB), which confuses storage admins. Change-Id: I62ab332d3415f35ead237dd1af5f6a11eb193654 Partially-Implements: blueprint gb-to-gib-conversion Closes-bug: #1511167
-rw-r--r--openstack_dashboard/dashboards/admin/defaults/tables.py4
-rw-r--r--openstack_dashboard/dashboards/admin/defaults/workflows.py2
-rw-r--r--openstack_dashboard/dashboards/admin/volumes/templates/volumes/snapshots/_detail_overview.html2
-rw-r--r--openstack_dashboard/dashboards/identity/projects/workflows.py2
-rw-r--r--openstack_dashboard/dashboards/project/volumes/templates/volumes/snapshots/_detail_overview.html2
-rw-r--r--openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_detail_overview.html2
-rw-r--r--openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_extend_limits.html4
-rw-r--r--openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_limits.html4
-rw-r--r--openstack_dashboard/dashboards/project/volumes/volumes/forms.py37
-rw-r--r--openstack_dashboard/dashboards/project/volumes/volumes/tables.py2
-rw-r--r--openstack_dashboard/dashboards/project/volumes/volumes/tests.py12
-rw-r--r--releasenotes/notes/gb-to-gib-conversion-8a91839030a2f570.yaml12
12 files changed, 47 insertions, 38 deletions
diff --git a/openstack_dashboard/dashboards/admin/defaults/tables.py b/openstack_dashboard/dashboards/admin/defaults/tables.py
index 7a7066839..90f11d56f 100644
--- a/openstack_dashboard/dashboards/admin/defaults/tables.py
+++ b/openstack_dashboard/dashboards/admin/defaults/tables.py
@@ -47,7 +47,7 @@ def get_quota_name(quota):
'injected_files': _('Injected Files'),
'volumes': _('Volumes'),
'snapshots': _('Volume Snapshots'),
- 'gigabytes': _('Total Size of Volumes and Snapshots (GB)'),
+ 'gigabytes': _('Total Size of Volumes and Snapshots (GiB)'),
'ram': _('RAM (MB)'),
'floating_ips': _('Floating IPs'),
'security_groups': _('Security Groups'),
@@ -57,7 +57,7 @@ def get_quota_name(quota):
'dm-crypt': _('dm-crypt'),
'server_group_members': _('Server Group Members'),
'server_groups': _('Server Groups'),
- 'backup_gigabytes': _('Backup Gigabytes'),
+ 'backup_gigabytes': _('Backup Size (GiB)'),
'backups': _('Backups'),
'per_volume_gigabytes': _('Per Volume Size (GiB)'),
}
diff --git a/openstack_dashboard/dashboards/admin/defaults/workflows.py b/openstack_dashboard/dashboards/admin/defaults/workflows.py
index 3011b3ba1..ae3d923e0 100644
--- a/openstack_dashboard/dashboards/admin/defaults/workflows.py
+++ b/openstack_dashboard/dashboards/admin/defaults/workflows.py
@@ -49,7 +49,7 @@ class UpdateDefaultQuotasAction(workflows.Action):
label=_("Security Groups"))
gigabytes = forms.IntegerField(
min_value=-1,
- label=_("Total Size of Volumes and Snapshots (GB)"))
+ label=_("Total Size of Volumes and Snapshots (GiB)"))
snapshots = forms.IntegerField(min_value=-1, label=_("Volume Snapshots"))
volumes = forms.IntegerField(min_value=-1, label=_("Volumes"))
diff --git a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/snapshots/_detail_overview.html b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/snapshots/_detail_overview.html
index 4d7e3aa62..78e7f1977 100644
--- a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/snapshots/_detail_overview.html
+++ b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/snapshots/_detail_overview.html
@@ -30,7 +30,7 @@
<hr class="header_rule">
<dl class="dl-horizontal">
<dt>{% trans "Size" %}</dt>
- <dd>{{ snapshot.size }} {% trans "GB" %}</dd>
+ <dd>{{ snapshot.size }} {% trans "GiB" %}</dd>
<dt>{% trans "Created" %}</dt>
<dd>{{ snapshot.created_at|parse_date }}</dd>
</dl>
diff --git a/openstack_dashboard/dashboards/identity/projects/workflows.py b/openstack_dashboard/dashboards/identity/projects/workflows.py
index 89bdd5b07..34b461eb1 100644
--- a/openstack_dashboard/dashboards/identity/projects/workflows.py
+++ b/openstack_dashboard/dashboards/identity/projects/workflows.py
@@ -55,7 +55,7 @@ class ProjectQuotaAction(workflows.Action):
volumes = forms.IntegerField(min_value=-1, label=_("Volumes"))
snapshots = forms.IntegerField(min_value=-1, label=_("Volume Snapshots"))
gigabytes = forms.IntegerField(
- min_value=-1, label=_("Total Size of Volumes and Snapshots (GB)"))
+ min_value=-1, label=_("Total Size of Volumes and Snapshots (GiB)"))
ram = forms.IntegerField(min_value=-1, label=_("RAM (MB)"))
floating_ips = forms.IntegerField(min_value=-1, label=_("Floating IPs"))
fixed_ips = forms.IntegerField(min_value=-1, label=_("Fixed IPs"))
diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/snapshots/_detail_overview.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/snapshots/_detail_overview.html
index 9d9251530..5b19687a2 100644
--- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/snapshots/_detail_overview.html
+++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/snapshots/_detail_overview.html
@@ -28,7 +28,7 @@
<hr class="header_rule">
<dl class="dl-horizontal">
<dt>{% trans "Size" %}</dt>
- <dd>{{ snapshot.size }} {% trans "GB" %}</dd>
+ <dd>{{ snapshot.size }} {% trans "GiB" %}</dd>
<dt>{% trans "Created" %}</dt>
<dd>{{ snapshot.created_at|parse_date }}</dd>
</dl>
diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_detail_overview.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_detail_overview.html
index c0b658c4b..e960e323f 100644
--- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_detail_overview.html
+++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_detail_overview.html
@@ -18,7 +18,7 @@
<hr class="header_rule">
<dl class="dl-horizontal">
<dt>{% trans "Size" %}</dt>
- <dd>{{ volume.size }} {% trans "GB" %}</dd>
+ <dd>{{ volume.size }} {% trans "GiB" %}</dd>
{% if volume.volume_type %}
<dt>{% trans "Type" %}</dt>
<dd>{{ volume.volume_type }}</dd>
diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_extend_limits.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_extend_limits.html
index 815ceeba8..580d3032c 100644
--- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_extend_limits.html
+++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_extend_limits.html
@@ -7,8 +7,8 @@
<h3>{% trans "Volume Limits" %}</h3>
<div class="quota_title clearfix">
- <strong>{% trans "Total Gigabytes" %} <span>({{ usages.gigabytesUsed|intcomma }} {% trans "GB" %})</span></strong>
- <p>{{ usages.maxTotalVolumeGigabytes|intcomma|quota:_("GB") }}</p>
+ <strong>{% trans "Total Gibibytes" %} <span>({{ usages.gigabytesUsed|intcomma }} {% trans "GiB" %})</span></strong>
+ <p>{{ usages.maxTotalVolumeGigabytes|intcomma|quota:_("GiB") }}</p>
</div>
<div id="quota_size" data-progress-indicator-for="id_new_size" data-quota-limit="{{ usages.maxTotalVolumeGigabytes }}" data-quota-used="{{ usages.gigabytesUsed }}" class="quota_bar">
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 587888a2b..dae4fcbe8 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 @@
<h3>{% block head %}{% trans "Volume Limits" %}{% endblock %}</h3>
<div class="quota_title clearfix">
- <strong>{% trans "Total Gigabytes" %} <span>({% block gigabytes_used %}{{ usages.gigabytesUsed|intcomma }}{% endblock %} {% trans "GB" %})</span></strong>
- <p>{{ usages.maxTotalVolumeGigabytes|intcomma|quota:_("GB") }}</p>
+ <strong>{% trans "Total Gibibytes" %} <span>({% block gigabytes_used %}{{ usages.gigabytesUsed|intcomma }}{% endblock %} {% trans "GiB" %})</span></strong>
+ <p>{{ usages.maxTotalVolumeGigabytes|intcomma|quota:_("GiB") }}</p>
</div>
<div id="quota_size" data-progress-indicator-for="id_size" data-quota-limit="{{ usages.maxTotalVolumeGigabytes }}" data-quota-used={% block gigabytes_used_progress %}"{{ usages.gigabytesUsed }}"{% endblock %} class="quota_bar">
diff --git a/openstack_dashboard/dashboards/project/volumes/volumes/forms.py b/openstack_dashboard/dashboards/project/volumes/volumes/forms.py
index 6125c2ecb..171b6bf08 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 cd6b62b0d..756e8dd57 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 b6a70d055..219baf80a 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 000000000..9bb41fc5e
--- /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 <https://blueprints.launchpad.net/horizon/+spec/gb-to-gib-conversion/> \ No newline at end of file