Add ram-hours in overview page
In the admin and project overview page, there has cpu-hours, disk-hours, but has no ram-hours. This patch add ram-hours for overview page. Change-Id: I4eaf7cd7639de570058bdb793a95045a0be5d224 Closes-bug:#1415775
This commit is contained in:
parent
1bff6943a7
commit
99ec0e70e7
@ -21,5 +21,6 @@
|
||||
<span><strong>{% trans "Active RAM:" %}</strong> {{ usage.summary.memory_mb|mb_float_format|default:'0' }}</span>
|
||||
<span><strong>{% trans "This Period's VCPU-Hours:" %}</strong> {{ usage.summary.vcpus|floatformat:2|default:'0' }}</span>
|
||||
<span><strong>{% trans "This Period's GB-Hours:" %}</strong> {{ usage.summary.disk_gb_hours|floatformat:2|default:'0' }}</span>
|
||||
<span><strong>{% trans "This Period's RAM-Hours:" %}</strong> {{ usage.summary.memory_mb_hours|floatformat:2|default:'0' }}</span>
|
||||
</p>
|
||||
</div>
|
||||
|
@ -155,7 +155,8 @@ class NovaUsage(base.APIResourceWrapper):
|
||||
'vcpus': getattr(self, "total_vcpus_usage", 0),
|
||||
'vcpu_hours': self.vcpu_hours,
|
||||
'local_gb': self.local_gb,
|
||||
'disk_gb_hours': self.disk_gb_hours}
|
||||
'disk_gb_hours': self.disk_gb_hours,
|
||||
'memory_mb_hours': self.memory_mb_hours}
|
||||
|
||||
@property
|
||||
def total_active_instances(self):
|
||||
@ -184,6 +185,10 @@ class NovaUsage(base.APIResourceWrapper):
|
||||
def disk_gb_hours(self):
|
||||
return getattr(self, "total_local_gb_usage", 0)
|
||||
|
||||
@property
|
||||
def memory_mb_hours(self):
|
||||
return getattr(self, "total_memory_mb_usage", 0)
|
||||
|
||||
|
||||
class SecurityGroup(base.APIResourceWrapper):
|
||||
"""Wrapper around novaclient.security_groups.SecurityGroup.
|
||||
|
@ -2,5 +2,6 @@
|
||||
{% trans "Active Instances" %}:,{{ usage.summary.instances }}
|
||||
{% trans "Total VCPU Usage (Hours)" %}:,{{ usage.summary.vcpu_hours|floatformat:2 }}
|
||||
{% trans "Total Active RAM (MB)" %}:,{{ usage.summary.memory_mb }}
|
||||
{% trans "Total Memory Usage (Hours)" %}:,{{ usage.summary.memory_mb_hours|floatformat:2 }}
|
||||
{% trans "Total Disk Size (GB)" %}:,{{ usage.summary.local_gb }}
|
||||
{% trans "Total Disk Usage (Hours)" %}:,{{ usage.summary.disk_gb_hours|floatformat:2 }}
|
||||
|
Can't render this file because it contains an unexpected character in line 1 and column 25.
|
@ -112,12 +112,14 @@ class UsageViewTests(test.BaseAdminViewTests):
|
||||
<td class="sortable normal_column">%s</td>
|
||||
<td class="sortable normal_column">%.2f</td>
|
||||
<td class="sortable normal_column">%.2f</td>
|
||||
<td class="sortable normal_column">%.2f</td>
|
||||
</tr>
|
||||
''' % (usage_list[0].vcpus,
|
||||
sizeformat.diskgbformat(usage_list[0].disk_gb_hours),
|
||||
sizeformat.mb_float_format(usage_list[0].memory_mb),
|
||||
usage_list[0].vcpu_hours,
|
||||
usage_list[0].total_local_gb_usage)
|
||||
usage_list[0].total_local_gb_usage,
|
||||
usage_list[0].memory_mb_hours)
|
||||
)
|
||||
|
||||
# test for deleted project
|
||||
@ -129,12 +131,14 @@ class UsageViewTests(test.BaseAdminViewTests):
|
||||
<td class="sortable normal_column">%s</td>
|
||||
<td class="sortable normal_column">%.2f</td>
|
||||
<td class="sortable normal_column">%.2f</td>
|
||||
<td class="sortable normal_column">%.2f</td>
|
||||
</tr>
|
||||
''' % (usage_list[1].vcpus,
|
||||
sizeformat.diskgbformat(usage_list[1].disk_gb_hours),
|
||||
sizeformat.mb_float_format(usage_list[1].memory_mb),
|
||||
usage_list[1].vcpu_hours,
|
||||
usage_list[1].total_local_gb_usage)
|
||||
usage_list[1].total_local_gb_usage,
|
||||
usage_list[1].memory_mb_hours)
|
||||
)
|
||||
|
||||
if nova_stu_enabled:
|
||||
|
@ -3,5 +3,6 @@
|
||||
{% trans "Active Instances" %}:,{{ usage.summary.instances }}
|
||||
{% trans "Total VCPU Usage (Hours)" %}:,{{ usage.summary.vcpu_hours|floatformat:2 }}
|
||||
{% trans "Total Active RAM (MB)" %}:,{{ usage.summary.memory_mb }}
|
||||
{% trans "Total Memory Usage (Hours)" %}:,{{ usage.summary.memory_mb_hours|floatformat:2 }}
|
||||
{% trans "Total Disk Size (GB)" %}:,{{ usage.summary.local_gb }}
|
||||
{% trans "Total Disk Usage (Hours)" %}:,{{ usage.summary.disk_gb_hours|floatformat:2 }}
|
||||
|
Can't render this file because it contains an unexpected character in line 1 and column 25.
|
@ -48,6 +48,11 @@ class GlobalUsageTable(BaseUsageTable):
|
||||
help_text=_("Total disk usage (GB * "
|
||||
"Hours Used) for the project"),
|
||||
filters=(lambda v: floatformat(v, 2),))
|
||||
memory_hours = tables.Column('memory_mb_hours',
|
||||
verbose_name=_("Memory MB Hours"),
|
||||
help_text=_("Total memory usage (MB * "
|
||||
"Hours Used) for the project"),
|
||||
filters=(lambda v: floatformat(v, 2),))
|
||||
|
||||
def get_object_id(self, datum):
|
||||
return datum.tenant_id
|
||||
@ -57,7 +62,7 @@ class GlobalUsageTable(BaseUsageTable):
|
||||
hidden_title = False
|
||||
verbose_name = _("Usage")
|
||||
columns = ("project", "vcpus", "disk", "memory",
|
||||
"hours", "disk_hours")
|
||||
"hours", "disk_hours", "memory_hours")
|
||||
table_actions = (CSVSummary,)
|
||||
multi_select = False
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user