Change in vdsm[master]: Adding callback function for close libvirt connection

ybronhei at redhat.com ybronhei at redhat.com
Thu Apr 11 08:05:19 UTC 2013


Yaniv Bronhaim has uploaded a new change for review.

Change subject: Adding callback function for close libvirt connection
......................................................................

Adding callback function for close libvirt connection

When libvirt connection gets closed we perform self fencing

Change-Id: I0debdc9fc5ac7c7fb848346d202f9ca76e8aa9f6
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=949192
Signed-off-by: Yaniv Bronhaim <ybronhei at redhat.com>
---
M lib/vdsm/libvirtconnection.py
1 file changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/99/13799/1

diff --git a/lib/vdsm/libvirtconnection.py b/lib/vdsm/libvirtconnection.py
index 4a9a09a..95933f0 100644
--- a/lib/vdsm/libvirtconnection.py
+++ b/lib/vdsm/libvirtconnection.py
@@ -99,6 +99,12 @@
 __connectionLock = threading.Lock()
 
 
+def closeConnHandler(cif):
+    cif.log.error('connection to libvirt broken. '
+                  'taking vdsm down.')
+    cif.prepareForShutdown()
+
+
 def get(cif=None):
     """Return current connection to libvirt or open a new one.
 
@@ -164,6 +170,8 @@
                     method = getattr(conn, name)
                     if callable(method) and name[0] != '_':
                         setattr(conn, name, wrapMethod(method))
+
+                conn.registerCloseCallback(closeConnHandler, cif)
             # In case we're running into troubles with keeping the connections
             # alive we should place here:
             # conn.setKeepAlive(interval=5, count=3)


--
To view, visit http://gerrit.ovirt.org/13799
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0debdc9fc5ac7c7fb848346d202f9ca76e8aa9f6
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei at redhat.com>


More information about the vdsm-patches mailing list