From 38054d9882ef40c7e112118b7f27b8a3981cab67 Mon Sep 17 00:00:00 2001 From: catborise Date: Wed, 25 Dec 2019 14:36:43 +0300 Subject: [PATCH] for instances add guest agent indicator: installed, connected. --- instances/templates/instance.html | 32 +++++++++++++++++++++++++------ vrtManager/instance.py | 4 ++-- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/instances/templates/instance.html b/instances/templates/instance.html index 2ca73a5..261ab76 100644 --- a/instances/templates/instance.html +++ b/instances/templates/instance.html @@ -13,15 +13,15 @@
- {% ifequal status 5 %} + {% if status == 5 %} {% trans "Off" %} - {% endifequal %} - {% ifequal status 1 %} + {% endif %} + {% if status == 1 %} {% trans "Active" %} - {% endifequal %} - {% ifequal status 3 %} + {% endif %} + {% if status == 3 %} {% trans "Suspend" %} - {% endifequal %} + {% endif %} | {% if cur_vcpu %} {{ cur_vcpu }} {% trans "Vcpu" %} @@ -34,6 +34,22 @@ {% for disk in disks %} {{ disk.size|filesizeformat }} {% trans "Disk" %} | {% endfor %} + + | on {{ compute.name }}{% if compute.name != compute.hostname %} - {{ compute.hostname }}{% endif %} @@ -1437,11 +1453,15 @@

{% trans "To Enable/Disable Qemu Guest Agent. Status:" %} + {% if status == 1 %} {% if guest_agent_ready %} {% else %} {% endif %}

+ {% else %} + + {% endif %}
{% csrf_token %}
diff --git a/vrtManager/instance.py b/vrtManager/instance.py index 71d44a2..27354db 100644 --- a/vrtManager/instance.py +++ b/vrtManager/instance.py @@ -1417,10 +1417,10 @@ class wvmInstance(wvmConnect): Return agent channel object if it is defined. """ for channel in doc.xpath('/domain/devices/channel'): - type = channel.get("type") + ch_type = channel.get("type") target = channel.find("target") target_name = target.get("name") - if type == "unix" and target_name == "org.qemu.guest_agent.0": + if ch_type == "unix" and target_name == "org.qemu.guest_agent.0": return channel return None