WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Add channel function to close an event channel and

To: xen-changelog@xxxxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Add channel function to close an event channel and
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Tue, 15 Mar 2005 11:58:01 +0000
Delivery-date: Fri, 25 Mar 2005 12:09:53 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-archive: <http://sourceforge.net/mailarchive/forum.php?forum=xen-changelog>
List-help: <mailto:xen-changelog-request@lists.sourceforge.net?subject=help>
List-id: <xen-changelog.lists.sourceforge.net>
List-post: <mailto:xen-changelog@lists.sourceforge.net>
List-subscribe: <https://lists.sourceforge.net/lists/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.sourceforge.net?subject=subscribe>
List-unsubscribe: <https://lists.sourceforge.net/lists/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.sourceforge.net?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-admin@xxxxxxxxxxxxxxxxxxxxx
ChangeSet 1.1775.1.4, 2005/03/15 11:58:01+00:00, mjw@xxxxxxxxxxxxxxxxxxx

         Add channel function to close an event channel and
         call when devices are destroyed.
            
         Signed-off-by: Mike Wray <mike.wray@xxxxxx>



 blkif.py   |    2 ++
 channel.py |   26 +++++++++++++++++++++++++-
 netif.py   |    2 ++
 3 files changed, 29 insertions(+), 1 deletion(-)


diff -Nru a/tools/python/xen/xend/server/blkif.py 
b/tools/python/xen/xend/server/blkif.py
--- a/tools/python/xen/xend/server/blkif.py     2005-03-25 07:08:34 -05:00
+++ b/tools/python/xen/xend/server/blkif.py     2005-03-25 07:08:34 -05:00
@@ -181,6 +181,8 @@
             self.close()
         d = defer.Deferred()
         d.addCallback(cb_destroy)
+        if self.evtchn:
+            channel.eventChannelClose(self.evtchn)
         self.send_be_disconnect(response=d)
         
     def send_be_disconnect(self, response=None):
diff -Nru a/tools/python/xen/xend/server/channel.py 
b/tools/python/xen/xend/server/channel.py
--- a/tools/python/xen/xend/server/channel.py   2005-03-25 07:08:34 -05:00
+++ b/tools/python/xen/xend/server/channel.py   2005-03-25 07:08:34 -05:00
@@ -11,7 +11,31 @@
 VIRQ_DOM_EXC    = 4  # (DOM0) Exceptional event for some domain.
 
 def eventChannel(dom1, dom2):
-    return xc.evtchn_bind_interdomain(dom1=dom1, dom2=dom2)
+    """Create an event channel between domains.
+    The returned dict contains dom1, dom2, port1 and port2 on success.
+
+    @return dict (empty on error)
+    """
+    evtchn = xc.evtchn_bind_interdomain(dom1=dom1, dom2=dom2)
+    if evtchn:
+        evtchn['dom1'] = dom1
+        evtchn['dom2'] = dom2
+    return evtchn
+
+def eventChannelClose(evtchn):
+    """Close an event channel that was opened by eventChannel().
+    """
+    def evtchn_close(dom, port):
+        if (dom is None) or (port is None): return
+        try:
+            xc.evtchn_close(dom=dom, port=port)
+        except Exception, ex:
+            pass
+        
+    if not evtchn: return
+    evtchn_close(evtchn.get('dom1'), evtchn.get('port1'))
+    evtchn_close(evtchn.get('dom2'), evtchn.get('port2'))
+    
 
 class ChannelFactory:
     """Factory for creating channels.
diff -Nru a/tools/python/xen/xend/server/netif.py 
b/tools/python/xen/xend/server/netif.py
--- a/tools/python/xen/xend/server/netif.py     2005-03-25 07:08:34 -05:00
+++ b/tools/python/xen/xend/server/netif.py     2005-03-25 07:08:34 -05:00
@@ -288,6 +288,8 @@
             if change:
                 self.reportStatus()
         log.debug("Destroying vif domain=%d vif=%d", self.controller.dom, 
self.vif)
+        if self.evtchn:
+            channel.eventChannelClose(self.evtchn)
         self.vifctl('down')
         d = self.send_be_disconnect()
         d.addCallback(cb_destroy)


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>