diff --git a/openstack_dashboard/dashboards/project/images/templates/images/images/_detail_overview.html b/openstack_dashboard/dashboards/project/images/templates/images/images/_detail_overview.html index 00d3e7770a..d09576c08d 100644 --- a/openstack_dashboard/dashboards/project/images/templates/images/images/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/images/templates/images/images/_detail_overview.html @@ -45,6 +45,10 @@
{% trans "Size" %}
{{ image.size|filesizeformat }}
+ {% if image.virtual_size %} +
{% trans "Virtual Size" %}
+
{{ image.virtual_size|filesizeformat }}
+ {% endif %}
{% trans "Container Format" %}
{{ image.container_format|default:_("None")|upper }}
{% trans "Disk Format" %}
diff --git a/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py b/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py index 0e6326a08c..4e4214f59c 100644 --- a/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py +++ b/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py @@ -426,7 +426,7 @@ class SetInstanceDetailsAction(workflows.Action): context.get('project_id'), self._images_cache) for image in images: - image.bytes = image.size + image.bytes = image.virtual_size or image.size image.volume_size = max( image.min_disk, functions.bytes_to_gigabytes(image.bytes)) choices.append((image.id, image)) diff --git a/openstack_dashboard/test/test_data/glance_data.py b/openstack_dashboard/test/test_data/glance_data.py index d3caf591f6..190e27c35b 100644 --- a/openstack_dashboard/test/test_data/glance_data.py +++ b/openstack_dashboard/test/test_data/glance_data.py @@ -74,6 +74,7 @@ def data(TEST): 'disk_format': u'qcow2', 'status': "active", 'size': 20 * 1024 ** 3, + 'virtual_size': None, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'novaImage', @@ -88,6 +89,7 @@ def data(TEST): 'name': 'private_image', 'status': "active", 'size': 10 * 1024 ** 2, + 'virtual_size': 20 * 1024 ** 2, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'aki', @@ -102,6 +104,7 @@ def data(TEST): 'status': "active", 'owner': TEST.tenant.id, 'size': 2 * 1024 ** 3, + 'virtual_size': None, 'min_disk': 30, 'container_format': 'novaImage', 'properties': {'image_type': u'image'}, @@ -115,6 +118,7 @@ def data(TEST): 'name': None, 'status': "active", 'size': 5 * 1024 ** 3, + 'virtual_size': None, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'novaImage', @@ -128,6 +132,7 @@ def data(TEST): 'name': 'private_image 2', 'status': "active", 'size': 30 * 1024 ** 3, + 'virtual_size': None, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'aki', @@ -140,6 +145,7 @@ def data(TEST): 'name': 'private_image 3', 'status': "active", 'size': 2 * 1024 ** 3, + 'virtual_size': None, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'aki', @@ -153,6 +159,7 @@ def data(TEST): 'name': 'shared_image 1', 'status': "active", 'size': 8 * 1024 ** 3, + 'virtual_size': None, 'min_disk': 0, 'owner': 'someothertenant', 'container_format': 'aki', @@ -167,6 +174,7 @@ def data(TEST): 'name': 'official_image 1', 'status': "active", 'size': 2 * 1024 ** 3, + 'virtual_size': None, 'min_disk': 0, 'owner': 'officialtenant', 'container_format': 'aki', @@ -179,6 +187,7 @@ def data(TEST): 'name': 'multi_prop_image', 'status': "active", 'size': 20 * 1024 ** 3, + 'virtual_size': None, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'novaImage', @@ -193,6 +202,7 @@ def data(TEST): image_dict = {'id': 'c8756975-7a3b-4e43-b7f7-433576112849', 'status': "active", 'size': 8 * 1024 ** 3, + 'virtual_size': None, 'min_disk': 0, 'owner': 'someothertenant', 'container_format': 'aki',