1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-01-23 21:55:20 +00:00

Add lib and qemu version info to compute overview

This commit is contained in:
catborise 2018-12-05 11:08:21 +03:00
parent 04d3568d1a
commit c98f0b1232
3 changed files with 29 additions and 1 deletions

View file

@ -42,6 +42,7 @@
<p>{% trans "Hostname" %}</p>
<p>{% trans "Hypervisors" %}</p>
<p>{% trans "Emulator" %}</p>
<p>{% trans "Version" %}</p>
<p>{% trans "Memory" %}</p>
<p>{% trans "Architecture" %}</p>
<p>{% trans "Logical CPUs" %}</p>
@ -55,10 +56,17 @@
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="label label-default">{{ arch }}</span>
{% for h in hpv %}
<span class="label label-primary">{{ h }}</span>{% endfor %}
<span class="label label-primary">{{ h }}</span>
{% endfor %}
{% endfor %}
</p>
<p>{{ emulator }}</p>
<p>
<span class="label label-default">{% trans 'Qemu' %} </span>
<span class="label label-primary">{{ version }}</span> &nbsp;
<span class="label label-default">{% trans 'Libvirt' %} </span>
<span class="label label-primary">{{ lib_version }}</span> &nbsp;
</p>
<p>{{ host_memory|filesizeformat }}</p>
<p>{{ host_arch }}</p>
<p>{{ logical_cpu }}</p>

View file

@ -157,6 +157,8 @@ def overview(request, compute_id):
hypervisor = conn.hypervisor_type()
mem_usage = conn.get_memory_usage()
emulator = conn.get_emulator(host_arch)
version = conn.get_version()
lib_version = conn.get_lib_version()
conn.close()
except libvirtError as lib_err:
error_messages.append(lib_err)

View file

@ -361,6 +361,24 @@ class wvmConnect(object):
virttype = self.hypervisor_type()[arch][0]
return self.wvm.getDomainCapabilities(emulatorbin, arch, machine, virttype)
def get_version(self):
ver = self.wvm.getVersion()
major = ver / 1000000
ver = ver % 1000000
minor = ver / 1000
ver = ver % 1000
release = ver
return "%s.%s.%s" % (major,minor,release)
def get_lib_version(self):
ver = self.wvm.getLibVersion()
major = ver / 1000000
ver %= 1000000
minor = ver / 1000
ver %= 1000
release = ver
return "%s.%s.%s" % (major,minor,release)
def is_kvm_supported(self):
"""Return KVM capabilities."""
return util.is_kvm_available(self.get_cap_xml())