[Kimchi-devel] [kimchi-devel][PATCH 2/2] Deregister peer information when kimchid exit
lvroyce at linux.vnet.ibm.com
lvroyce at linux.vnet.ibm.com
Mon Mar 16 10:07:48 UTC 2015
From: Royce Lv <lvroyce at linux.vnet.ibm.com>
Peer information after kimchid exit,
fix this by deregister from slpd when cherrypy engine exit.
Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
src/kimchi/model/peers.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/kimchi/model/peers.py b/src/kimchi/model/peers.py
index a9f5fcd..611ac82 100644
--- a/src/kimchi/model/peers.py
+++ b/src/kimchi/model/peers.py
@@ -17,6 +17,7 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+import cherrypy
import re
import socket
@@ -41,6 +42,17 @@ class PeersModel(object):
if out and len(out) != 0:
kimchi_log.error("Unable to register server on openSLP."
" Details: %s" % out)
+ cherrypy.engine.subscribe('exit', self._peer_deregister)
+
+
+ def _peer_deregister(self):
+ cmd = ["slptool", "deregister",
+ "service:kimchid://%s" % self.url]
+ out, error, ret = run_command(cmd)
+ if out and len(out) != 0:
+ kimchi_log.error("Unable to deregister server on openSLP."
+ " Details: %s" % out)
+
def get_list(self):
# check federation feature is enabled on Kimchi server
--
1.9.1
More information about the Kimchi-devel
mailing list