incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strou...@apache.org
Subject svn commit: r1366278 - /incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py
Date Fri, 27 Jul 2012 04:18:25 GMT
Author: stroucki
Date: Fri Jul 27 04:18:24 2012
New Revision: 1366278

URL: http://svn.apache.org/viewvc?rev=1366278&view=rev
Log:
nodemanagerservice: make IP discovery optional (for systems where required python libraries
are not available)

Modified:
    incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py

Modified: incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py?rev=1366278&r1=1366277&r2=1366278&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py (original)
+++ incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py Fri Jul 27 04:18:24
2012
@@ -19,7 +19,18 @@ import logging
 import socket
 import threading
 import time
-import dpkt, pcap
+
+# these allow discovery of IP addresses assigned to the VM.
+# making these optional in case of ancient installs that don't
+# have provided python-pypcap or python-dpkt packages
+global haveIpDiscovery
+haveIpDiscovery = False
+try:
+	import dpkt, pcap
+	haveIpDiscovery = True
+except ImportError:
+	pass
+	
 from struct import pack
 
 from tashi.rpycservices.rpyctypes import InstanceState, TashiException, Errors, Instance
@@ -76,10 +87,18 @@ class NodeManagerService(object):
 		# This can time out now with an exception
 		self.id = self.cm.registerNodeManager(self.host, self.instances.values())
 
+		# make arp monitoring optional
+		self.haveIpDiscovery = False
+		if "haveIpDiscovery" in globals():
+			self.haveIpDiscovery = haveIpDiscovery
+
 		# start service threads
 		threading.Thread(name="registerWithClusterManager", target=self.__registerWithClusterManager).start()
 		threading.Thread(name="statsThread", target=self.__statsThread).start()
-		threading.Thread(name="arpMonitorThread", target=self.__arpMonitorThread, args=(config,)).start()
+		if self.haveIpDiscovery:
+			threading.Thread(name="arpMonitorThread", target=self.__arpMonitorThread, args=(config,)).start()
+		else:
+			self.log.warning("Disabling ARP monitoring thread")
 
 	def __initAccounting(self):
 		self.accountBuffer = []



Mime
View raw message