From: Ondrej Lichtner <olichtne(a)redhat.com>
Machine cleanup would sometimes end with a KeyError. This would happen
when recipe parsing failed too soon and no machines were parsed yet.
This commit fixes that.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
NetTest/NetTestController.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/NetTest/NetTestController.py b/NetTest/NetTestController.py
index 548fc17..95326e3 100644
--- a/NetTest/NetTestController.py
+++ b/NetTest/NetTestController.py
@@ -264,6 +264,8 @@ class NetTestController:
rpc.set_logging(ip_addr, self._config.get_option('log', 'port'))
def _deconfigure_slaves(self):
+ if 'machines' not in self._recipe:
+ return
for machine_id in self._recipe["machines"]:
info = self._get_machineinfo(machine_id)
if "rpc" not in info:
@@ -288,6 +290,8 @@ class NetTestController:
net["default_bridge"].cleanup()
def _disconnect_slaves(self):
+ if 'machines' not in self._recipe:
+ return
for machine_id in self._recipe["machines"]:
info = self._get_machineinfo(machine_id)
if self._remoteexec and "session" in info:
--
1.7.11.4
Show replies by date
From: Ondrej Lichtner <olichtne(a)redhat.com>
Currently logging doesn't work correctly if the connection between a
slave and the controller isn't properly set up. This can be for example
caused by a firewall. In these cases it can be confusing to users
because there is no indication of it other than missing logs.
This patch changes that. Slaves now check if they are able to connect to
the logging server and inform the controller of the results. The
controller can then log an error message in case of a failure.
I tried making the error message more visible so that it's harder to
overlook.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
NetTest/NetTestController.py | 6 +++++-
NetTest/NetTestSlave.py | 11 ++++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/NetTest/NetTestController.py b/NetTest/NetTestController.py
index 95326e3..526a3e7 100644
--- a/NetTest/NetTestController.py
+++ b/NetTest/NetTestController.py
@@ -261,7 +261,11 @@ class NetTestController:
logging.info("Setting logging server on machine %s", hostname)
rpc = self._get_machinerpc(machine_id)
ip_addr = get_corespond_local_ip(hostname)
- rpc.set_logging(ip_addr, self._config.get_option('log', 'port'))
+ if not rpc.set_logging(ip_addr, self._config.get_option('log',
'port')):
+
logging.error("==================================================")
+ logging.error("Machine %s is unable to connect to the logging "\
+ "server! Check your firewall settings." % hostname)
+
logging.error("==================================================")
def _deconfigure_slaves(self):
if 'machines' not in self._recipe:
diff --git a/NetTest/NetTestSlave.py b/NetTest/NetTestSlave.py
index 7c391f8..40eae7c 100644
--- a/NetTest/NetTestSlave.py
+++ b/NetTest/NetTestSlave.py
@@ -15,6 +15,7 @@ from Common.Logs import Logs, log_exc_traceback
import signal
import select, logging
import os
+import socket
from Common.PacketCapture import PacketCapture
from Common.XmlRpc import Server
from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
@@ -45,8 +46,16 @@ class NetTestSlaveXMLRPC:
@param logger_address: Address of running logger.
"""
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ try:
+ s.connect((logger_address, port))
+ s.shutdown(2)
+ connectable = True
+ except:
+ connectable = False
+
Logs.append_network_hadler(logger_address, port)
- return True
+ return connectable
def get_devices_by_hwaddr(self, hwaddr):
name_scan = scan_netdevs()
--
1.7.11.4