1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-24 23:25:24 +00:00

calling hypervisor, machine, emulator operation is linked to arch variable.

This commit is contained in:
catborise 2018-10-02 15:15:41 +03:00
parent ea4f2cba8b
commit 7d21c138b7
4 changed files with 22 additions and 9 deletions

View file

@ -49,7 +49,7 @@
<p>{% trans "Connection" %}</p> <p>{% trans "Connection" %}</p>
<p>{% trans "Details" %}</p> <p>{% trans "Details" %}</p>
</div> </div>
<div class="col-xs-8 col-sm-7"> <div class="col-xs-8 col-sm-9">
<p>{{ hostname }}</p> <p>{{ hostname }}</p>
<p>{% for arch, hpv in hypervisor.items %} <p>{% for arch, hpv in hypervisor.items %}
<span class="glyphicon glyphicon-chevron-right"></span> <span class="glyphicon glyphicon-chevron-right"></span>

View file

@ -156,7 +156,7 @@ def overview(request, compute_id):
hostname, host_arch, host_memory, logical_cpu, model_cpu, uri_conn = conn.get_node_info() hostname, host_arch, host_memory, logical_cpu, model_cpu, uri_conn = conn.get_node_info()
hypervisor = conn.hypervisor_type() hypervisor = conn.hypervisor_type()
mem_usage = conn.get_memory_usage() mem_usage = conn.get_memory_usage()
emulator = conn.emulator() emulator = conn.get_emulator(host_arch)
conn.close() conn.close()
except libvirtError as lib_err: except libvirtError as lib_err:
error_messages.append(lib_err) error_messages.append(lib_err)

View file

@ -10,7 +10,9 @@
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
{% if request.user.is_superuser %} {% if request.user.is_superuser %}
{% include 'create_inst_block.html' %} <a href="{% url 'create_instance' compute.id %}" type="button" class="btn btn-success btn-header pull-right" data-toggle="modal">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
</a>
{% endif %} {% endif %}
{% if all_host_vms or all_user_vms %} {% if all_host_vms or all_user_vms %}
<div class="pull-right search"> <div class="pull-right search">

View file

@ -354,9 +354,10 @@ class wvmConnect(object):
def get_dom_cap_xml(self): def get_dom_cap_xml(self):
""" Return domcapabilities xml""" """ Return domcapabilities xml"""
emulatorbin = self.emulator()
machine = self.machine()
arch = self.wvm.getInfo()[0] arch = self.wvm.getInfo()[0]
machine = self.get_machines(arch)
emulatorbin = self.get_emulator(arch)
virttype = self.hypervisor_type()[arch][0] virttype = self.hypervisor_type()[arch][0]
return self.wvm.getDomainCapabilities(emulatorbin, arch, machine, virttype) return self.wvm.getDomainCapabilities(emulatorbin, arch, machine, virttype)
@ -417,13 +418,23 @@ class wvmConnect(object):
return result return result
return util.get_xml_path(self.get_cap_xml(), func=hypervisors) return util.get_xml_path(self.get_cap_xml(), func=hypervisors)
def emulator(self): def get_emulator(self, arch):
"""Return emulator """ """Return emulator """
return util.get_xml_path(self.get_cap_xml(), "/capabilities/guest/arch/emulator") return util.get_xml_path(self.get_cap_xml(), "/capabilities/guest/arch[@name='{}']/emulator".format(arch))
def machine(self): def get_emulators(self):
def emulators(ctx):
result = {}
for arch in ctx.xpath('/capabilities/guest/arch'):
emulator = arch.xpath('emulator')
arch_name = arch.xpath('@name')[0]
result[arch_name]= emulator
return result
return util.get_xml_path(self.get_cap_xml(), func=emulators)
def get_machines(self, arch):
""" Return machine type of emulation""" """ Return machine type of emulation"""
return util.get_xml_path(self.get_cap_xml(), "/capabilities/guest/arch/machine") return util.get_xml_path(self.get_cap_xml(), "/capabilities/guest/arch[@name='{}']/machine".format(arch))
def get_busses(self): def get_busses(self):
"""Get available busses""" """Get available busses"""