From 3cd4212cdd01612adbea700aca956d12c8e6fafd Mon Sep 17 00:00:00 2001 From: cserma Date: Wed, 10 May 2023 13:59:13 +0300 Subject: [PATCH] modified 'create new instance' screen with compute details --- computes/models.py | 4 ++ instances/templates/allinstances.html | 4 +- instances/templates/create_inst_block.html | 61 +++++++++++++--------- 3 files changed, 42 insertions(+), 27 deletions(-) diff --git a/computes/models.py b/computes/models.py index f81eafa..86df52a 100644 --- a/computes/models.py +++ b/computes/models.py @@ -48,6 +48,10 @@ class Compute(Model): @cached_property def cpu_count(self): return self.proxy.get_node_info()[3] + + @cached_property + def cpu_usage(self): + return round(self.proxy.get_cpu_usage().get('usage')) @cached_property def ram_size(self): diff --git a/instances/templates/allinstances.html b/instances/templates/allinstances.html index 457d9f6..b600db5 100644 --- a/instances/templates/allinstances.html +++ b/instances/templates/allinstances.html @@ -39,8 +39,8 @@ {% if request.user.is_superuser %} diff --git a/instances/templates/create_inst_block.html b/instances/templates/create_inst_block.html index e069773..6ef1915 100644 --- a/instances/templates/create_inst_block.html +++ b/instances/templates/create_inst_block.html @@ -5,7 +5,7 @@