fix usage property(vcpus, vcpu_hours) error use

Change usage property vpcus and vcpu_hours,
vcpus describe vcpu num, vcpu_hours describe
vcpu hours

Closes-bug:#1416984

Change-Id: Ia24a34f2d645b30067c68be3863083cffce193ce
This commit is contained in:
tinytmy 2015-02-03 10:52:51 +08:00
parent b0413179c6
commit 8e0188773a
2 changed files with 3 additions and 3 deletions

View File

@ -19,7 +19,7 @@
<p id="activity">
<span><strong>{% trans "Active Instances:" %}</strong> {{ usage.summary.instances|default:'0' }}</span>
<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 VCPU-Hours:" %}</strong> {{ usage.summary.vcpu_hours|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>

View File

@ -160,7 +160,7 @@ class NovaUsage(base.APIResourceWrapper):
def get_summary(self):
return {'instances': self.total_active_instances,
'memory_mb': self.memory_mb,
'vcpus': getattr(self, "total_vcpus_usage", 0),
'vcpus': self.vcpus,
'vcpu_hours': self.vcpu_hours,
'local_gb': self.local_gb,
'disk_gb_hours': self.disk_gb_hours,
@ -177,7 +177,7 @@ class NovaUsage(base.APIResourceWrapper):
@property
def vcpu_hours(self):
return getattr(self, "total_hours", 0)
return getattr(self, "total_vcpus_usage", 0)
@property
def local_gb(self):