Merge "Add virtual size to image detail"

This commit is contained in:
Jenkins 2015-02-12 15:30:30 +00:00 committed by Gerrit Code Review
commit 74e8d1b34a
3 changed files with 15 additions and 1 deletions

View File

@ -45,6 +45,10 @@
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>{% trans "Size" %}</dt> <dt>{% trans "Size" %}</dt>
<dd>{{ image.size|filesizeformat }}</dd> <dd>{{ image.size|filesizeformat }}</dd>
{% if image.virtual_size %}
<dt>{% trans "Virtual Size" %}</dt>
<dd>{{ image.virtual_size|filesizeformat }}</dd>
{% endif %}
<dt>{% trans "Container Format" %}</dt> <dt>{% trans "Container Format" %}</dt>
<dd>{{ image.container_format|default:_("None")|upper }}</dd> <dd>{{ image.container_format|default:_("None")|upper }}</dd>
<dt>{% trans "Disk Format" %}</dt> <dt>{% trans "Disk Format" %}</dt>

View File

@ -426,7 +426,7 @@ class SetInstanceDetailsAction(workflows.Action):
context.get('project_id'), context.get('project_id'),
self._images_cache) self._images_cache)
for image in images: for image in images:
image.bytes = image.size image.bytes = image.virtual_size or image.size
image.volume_size = max( image.volume_size = max(
image.min_disk, functions.bytes_to_gigabytes(image.bytes)) image.min_disk, functions.bytes_to_gigabytes(image.bytes))
choices.append((image.id, image)) choices.append((image.id, image))

View File

@ -74,6 +74,7 @@ def data(TEST):
'disk_format': u'qcow2', 'disk_format': u'qcow2',
'status': "active", 'status': "active",
'size': 20 * 1024 ** 3, 'size': 20 * 1024 ** 3,
'virtual_size': None,
'min_disk': 0, 'min_disk': 0,
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
'container_format': 'novaImage', 'container_format': 'novaImage',
@ -88,6 +89,7 @@ def data(TEST):
'name': 'private_image', 'name': 'private_image',
'status': "active", 'status': "active",
'size': 10 * 1024 ** 2, 'size': 10 * 1024 ** 2,
'virtual_size': 20 * 1024 ** 2,
'min_disk': 0, 'min_disk': 0,
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
'container_format': 'aki', 'container_format': 'aki',
@ -102,6 +104,7 @@ def data(TEST):
'status': "active", 'status': "active",
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
'size': 2 * 1024 ** 3, 'size': 2 * 1024 ** 3,
'virtual_size': None,
'min_disk': 30, 'min_disk': 30,
'container_format': 'novaImage', 'container_format': 'novaImage',
'properties': {'image_type': u'image'}, 'properties': {'image_type': u'image'},
@ -115,6 +118,7 @@ def data(TEST):
'name': None, 'name': None,
'status': "active", 'status': "active",
'size': 5 * 1024 ** 3, 'size': 5 * 1024 ** 3,
'virtual_size': None,
'min_disk': 0, 'min_disk': 0,
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
'container_format': 'novaImage', 'container_format': 'novaImage',
@ -128,6 +132,7 @@ def data(TEST):
'name': 'private_image 2', 'name': 'private_image 2',
'status': "active", 'status': "active",
'size': 30 * 1024 ** 3, 'size': 30 * 1024 ** 3,
'virtual_size': None,
'min_disk': 0, 'min_disk': 0,
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
'container_format': 'aki', 'container_format': 'aki',
@ -140,6 +145,7 @@ def data(TEST):
'name': 'private_image 3', 'name': 'private_image 3',
'status': "active", 'status': "active",
'size': 2 * 1024 ** 3, 'size': 2 * 1024 ** 3,
'virtual_size': None,
'min_disk': 0, 'min_disk': 0,
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
'container_format': 'aki', 'container_format': 'aki',
@ -153,6 +159,7 @@ def data(TEST):
'name': 'shared_image 1', 'name': 'shared_image 1',
'status': "active", 'status': "active",
'size': 8 * 1024 ** 3, 'size': 8 * 1024 ** 3,
'virtual_size': None,
'min_disk': 0, 'min_disk': 0,
'owner': 'someothertenant', 'owner': 'someothertenant',
'container_format': 'aki', 'container_format': 'aki',
@ -167,6 +174,7 @@ def data(TEST):
'name': 'official_image 1', 'name': 'official_image 1',
'status': "active", 'status': "active",
'size': 2 * 1024 ** 3, 'size': 2 * 1024 ** 3,
'virtual_size': None,
'min_disk': 0, 'min_disk': 0,
'owner': 'officialtenant', 'owner': 'officialtenant',
'container_format': 'aki', 'container_format': 'aki',
@ -179,6 +187,7 @@ def data(TEST):
'name': 'multi_prop_image', 'name': 'multi_prop_image',
'status': "active", 'status': "active",
'size': 20 * 1024 ** 3, 'size': 20 * 1024 ** 3,
'virtual_size': None,
'min_disk': 0, 'min_disk': 0,
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
'container_format': 'novaImage', 'container_format': 'novaImage',
@ -193,6 +202,7 @@ def data(TEST):
image_dict = {'id': 'c8756975-7a3b-4e43-b7f7-433576112849', image_dict = {'id': 'c8756975-7a3b-4e43-b7f7-433576112849',
'status': "active", 'status': "active",
'size': 8 * 1024 ** 3, 'size': 8 * 1024 ** 3,
'virtual_size': None,
'min_disk': 0, 'min_disk': 0,
'owner': 'someothertenant', 'owner': 'someothertenant',
'container_format': 'aki', 'container_format': 'aki',