[vmhost] add used_ram_in_gb
This commit is contained in:
parent
b9473c1803
commit
6a382fab23
1 changed files with 4 additions and 0 deletions
|
@ -45,6 +45,10 @@ class VMHost(models.Model):
|
|||
def vms(self):
|
||||
return VMProduct.objects.filter(vmhost=self)
|
||||
|
||||
@property
|
||||
def used_ram_in_gb(self):
|
||||
return sum([vm.ram_in_gb for vm in VMProduct.objects.filter(vmhost=self)])
|
||||
|
||||
@property
|
||||
def available_ram_in_gb(self):
|
||||
return self.usable_ram_in_gb - sum([vm.ram_in_gb for vm in self.vms ])
|
||||
|
|
Loading…
Reference in a new issue