diff --git a/computes/templates/computes/instances.html b/computes/templates/computes/instances.html
index 8a41bc96..ca5bb03c 100644
--- a/computes/templates/computes/instances.html
+++ b/computes/templates/computes/instances.html
@@ -87,18 +87,18 @@
- {% if instance.proxy.instance.info.0 == 1 %}
+ {% if instance.info.0 == 1 %}
{% trans "Active" %}
{% endif %}
- {% if instance.proxy.instance.info.0 == 5 %}
+ {% if instance.info.0 == 5 %}
{% trans "Off" %}
{% endif %}
- {% if instance.proxy.instance.info.0 == 3 %}
+ {% if instance.info.0 == 3 %}
{% trans "Suspended" %}
{% endif %}
|
- {{ instance.proxy.instance.info.3 }} |
- {% widthratio instance.proxy.instance.info.1 1024 1 %} MiB |
+ {{ instance.info.3 }} |
+ {% widthratio instance.info.1 1024 1 %} MiB |
{% include 'instance_actions.html' %}
|
diff --git a/instances/models.py b/instances/models.py
index 91fb4472..0ca07c47 100644
--- a/instances/models.py
+++ b/instances/models.py
@@ -63,6 +63,11 @@ class Instance(models.Model):
def disks(self) -> list[dict]:
return self.proxy.get_disk_devices()
+ @cached_property
+ def info(self) -> list:
+ """virDomainGetInfo, read once: state, max memory KiB, memory KiB, vCPUs, CPU time"""
+ return self.proxy.instance.info()
+
@cached_property
def status(self) -> int:
return self.proxy.get_status()
diff --git a/instances/templates/allinstances_index_grouped.html b/instances/templates/allinstances_index_grouped.html
index 290abe03..8e9f7f9a 100644
--- a/instances/templates/allinstances_index_grouped.html
+++ b/instances/templates/allinstances_index_grouped.html
@@ -62,9 +62,9 @@
- {% if instance.proxy.instance.info.0 == 1 %}{% trans "Active" %}{% endif %}
- {% if instance.proxy.instance.info.0 == 5 %}{% trans "Off" %}{% endif %}
- {% if instance.proxy.instance.info.0 == 3 %}
+ {% if instance.info.0 == 1 %}{% trans "Active" %}{% endif %}
+ {% if instance.info.0 == 5 %}{% trans "Off" %}{% endif %}
+ {% if instance.info.0 == 3 %}
{% trans "Suspended" %}
{% endif %}
|
@@ -73,8 +73,8 @@
{% if instance.drbd == "Primary/OK" or instance.drbd == "Secondary/OK" %}{% else %}{% endif %}{{ instance.drbd }}
{% endif %}
- {{ instance.proxy.instance.info.3 }} |
- {{ instance.cur_memory }} MB |
+ {{ instance.info.3 }} |
+ {% widthratio instance.info.2 1024 1 %} MB |
{% include 'instance_actions.html' %}
|
diff --git a/instances/templates/allinstances_index_nongrouped.html b/instances/templates/allinstances_index_nongrouped.html
index c5b06b66..5a35c243 100644
--- a/instances/templates/allinstances_index_nongrouped.html
+++ b/instances/templates/allinstances_index_nongrouped.html
@@ -40,11 +40,11 @@
{% endif %}
- {% if instance.proxy.instance.info.0 == 1 %}{% trans "Active" %}{% endif %}
- {% if instance.proxy.instance.info.0 == 5 %}{% trans "Off" %}{% endif %}
- {% if instance.proxy.instance.info.0 == 3 %}{% trans "Suspended" %}{% endif %}
|
{% if app_settings.VM_DRBD_STATUS == 'True' %}
@@ -52,8 +52,8 @@
{% if instance.drbd == "Primary/OK" or instance.drbd == "Secondary/OK" %}{% else %}{% endif %}{{ instance.drbd }}
{% endif %}
- {{ instance.proxy.instance.info.3 }} |
- {{ instance.cur_memory }} MB |
+ {{ instance.info.3 }} |
+ {% widthratio instance.info.2 1024 1 %} MB |
{% include 'instance_actions.html' %}
|
diff --git a/instances/templates/instance_actions.html b/instances/templates/instance_actions.html
index f3f24fdc..f1b56e86 100644
--- a/instances/templates/instance_actions.html
+++ b/instances/templates/instance_actions.html
@@ -1,7 +1,7 @@
{% load i18n %}
{% load bootstrap_icons %}