From 812bbb2ccc5ff22926ce322e5c5f9c784e1c86e4 Mon Sep 17 00:00:00 2001 From: "Ing. Jan KRCMAR" Date: Tue, 25 Sep 2018 23:25:06 +0200 Subject: [PATCH 1/4] console-spice-full fix scheme wss when accessing from https --- console/templates/console-spice-full.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/console/templates/console-spice-full.html b/console/templates/console-spice-full.html index 4bf75af..5accf4d 100644 --- a/console/templates/console-spice-full.html +++ b/console/templates/console-spice-full.html @@ -100,6 +100,9 @@ host = document.getElementById("host").value; port = document.getElementById("port").value; + if (window.location.protocol == 'https:') { + scheme = "wss://"; + } password = document.getElementById("password").value; From cdb5c4f4128852aa06b3485a47c33e930ee1fba6 Mon Sep 17 00:00:00 2001 From: "Ing. Jan KRCMAR" Date: Wed, 26 Sep 2018 09:53:23 +0200 Subject: [PATCH 2/4] fix wvmInterface get_ipv4/6: xml_path should specify protocol family --- vrtManager/interface.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vrtManager/interface.py b/vrtManager/interface.py index 9d04630..c91aaf9 100644 --- a/vrtManager/interface.py +++ b/vrtManager/interface.py @@ -81,7 +81,7 @@ class wvmInterface(wvmConnect): def get_ipv4_type(self): try: xml = self._XMLDesc(VIR_INTERFACE_XML_INACTIVE) - ipaddr = util.get_xml_path(xml, "/interface/protocol/ip/@address") + ipaddr = util.get_xml_path(xml, "/interface/protocol[@family='ipv4']/ip/@address") if ipaddr: return 'static' else: @@ -91,8 +91,8 @@ class wvmInterface(wvmConnect): def get_ipv4(self): xml = self._XMLDesc() - int_ipv4_ip = util.get_xml_path(xml, "/interface/protocol/ip/@address") - int_ipv4_mask = util.get_xml_path(xml, "/interface/protocol/ip/@prefix") + int_ipv4_ip = util.get_xml_path(xml, "/interface/protocol[@family='ipv4']/ip/@address") + int_ipv4_mask = util.get_xml_path(xml, "/interface/protocol[@family='ipv4']/ip/@prefix") if not int_ipv4_ip or not int_ipv4_mask: return None else: @@ -101,7 +101,7 @@ class wvmInterface(wvmConnect): def get_ipv6_type(self): try: xml = self._XMLDesc(VIR_INTERFACE_XML_INACTIVE) - ipaddr = util.get_xml_path(xml, "/interface/protocol[2]/ip/@address") + ipaddr = util.get_xml_path(xml, "/interface/protocol[@family='ipv6']/ip/@address") if ipaddr: return 'static' else: @@ -111,8 +111,8 @@ class wvmInterface(wvmConnect): def get_ipv6(self): xml = self._XMLDesc() - int_ipv6_ip = util.get_xml_path(xml, "/interface/protocol[2]/ip/@address") - int_ipv6_mask = util.get_xml_path(xml, "/interface/protocol[2]/ip/@prefix") + int_ipv6_ip = util.get_xml_path(xml, "/interface/protocol[@family='ipv6']/ip/@address") + int_ipv6_mask = util.get_xml_path(xml, "/interface/protocol[@family='ipv6']/ip/@prefix") if not int_ipv6_ip or not int_ipv6_mask: return None else: From dd3dc0861485ce0ba34a1225ef6c637d2e19dd92 Mon Sep 17 00:00:00 2001 From: "Ing. Jan KRCMAR" Date: Mon, 1 Oct 2018 10:30:22 +0200 Subject: [PATCH 3/4] instance poweron checks is_template attribute. templates should not be started. --- instances/views.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/instances/views.py b/instances/views.py index ec6adbc..7145bbe 100644 --- a/instances/views.py +++ b/instances/views.py @@ -138,10 +138,14 @@ def instances(request): instance.compute.password, instance.compute.type) if 'poweron' in request.POST: - msg = _("Power On") - addlogmsg(request.user.username, instance.name, msg) - conn.start(name) - return HttpResponseRedirect(request.get_full_path()) + if instance.is_template: + msg = _("Templates cannot be started.") + error_messages.append(msg) + else: + msg = _("Power On") + addlogmsg(request.user.username, instance.name, msg) + conn.start(name) + return HttpResponseRedirect(request.get_full_path()) if 'poweroff' in request.POST: msg = _("Power Off") @@ -412,10 +416,14 @@ def instance(request, compute_id, vname): if request.method == 'POST': if 'poweron' in request.POST: - conn.start() - msg = _("Power On") - addlogmsg(request.user.username, instance.name, msg) - return HttpResponseRedirect(request.get_full_path() + '#poweron') + if instance.is_template: + msg = _("Templates cannot be started.") + error_messages.append(msg) + else: + conn.start() + msg = _("Power On") + addlogmsg(request.user.username, instance.name, msg) + return HttpResponseRedirect(request.get_full_path() + '#poweron') if 'powercycle' in request.POST: conn.force_shutdown() From 3fa3472477d3baacf3a48ea61540f911c9c81654 Mon Sep 17 00:00:00 2001 From: "Ing. Jan KRCMAR" Date: Mon, 1 Oct 2018 10:31:26 +0200 Subject: [PATCH 4/4] console/templates/console-base.html fix html tag console/templates/console-spice-lite.html add console log message --- console/templates/console-base.html | 2 +- console/templates/console-spice-lite.html | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/console/templates/console-base.html b/console/templates/console-base.html index c7ea6d4..1446850 100644 --- a/console/templates/console-base.html +++ b/console/templates/console-base.html @@ -89,7 +89,7 @@ -/nav> +
{% block content %}{% endblock %}
diff --git a/console/templates/console-spice-lite.html b/console/templates/console-spice-lite.html index 4d4c4e3..19e9dee 100644 --- a/console/templates/console-spice-lite.html +++ b/console/templates/console-spice-lite.html @@ -108,6 +108,7 @@ function connect() { var host, port, password, scheme = "ws://", uri; + console.log('>> connect'); // By default, use the host and port of server that served this file //host = spice_query_var('host', window.location.hostname); @@ -170,6 +171,7 @@ disconnect(); } + console.log('<< connect'); }