def resources(self):
"""Return tuple with total (cpu, ram, disk) resources"""
# We are working with decimal objects and rounding everything down
decimal.getcontext().rounding = decimal.ROUND_DOWN
# The total local disk size should not include backups and snapshots
# TODO: fix ns.size_images and subtract it too
disk_size_total = self.storage.size_total
if self._ns:
disk_size_total -= self._ns.size_backups + self._ns.size_snapshots + self._ns.size_rep_snapshots
return self.cpu * float(self.cpu_coef), self.ram * float(self.ram_coef), disk_size_total
评论列表
文章目录