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-devel

[Xen-devel] [PATCH RFC 5/5] Grant table for console, xenstore pages

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH RFC 5/5] Grant table for console, xenstore pages
From: Diego Ongaro <diego.ongaro@xxxxxxxxxx>
Date: Fri, 11 Jul 2008 20:17:50 +0100
Delivery-date: Fri, 11 Jul 2008 12:18:04 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4877B09E.5000909@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4877B09E.5000909@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla-Thunderbird 2.0.0.14 (X11/20080509)
If each of the files /var/run/{console,xenstore}.did contains an
integer, this integer is interpreted as the domain id for that daemon.
The default or fallback is domid=0, of course. In this patch, xend is
modified to use this mechanism for the allocated unbound ports.

Signed-off-by: Diego Ongaro <diego.ongaro@xxxxxxxxxx>
---
diff -r 581c5525e1ac tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Thu Jul 10 19:50:48 2008 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Fri Jul 11 15:30:06 2008 +0100
@@ -2427,17 +2427,26 @@
     def _createChannels(self):
         """Create the channels to the domain.
         """
-        self.store_port = self._createChannel()
-        self.console_port = self._createChannel()
+        def read_domid(service):
+            try:
+                f = open("/var/run/%s.did" % service)
+                try:
+                    return int(f.read())
+                finally:
+                    f.close()
+            except (IOError, ValueError):
+                return 0 # assume domain 0 is providing service
 
+        self.store_port = self._createChannel(read_domid("xenstore"))
+        self.console_port = self._createChannel(read_domid("console"))
 
-    def _createChannel(self):
+    def _createChannel(self, remote_dom):
         """Create an event channel to the domain.
         """
         try:
             if self.domid != None:
                 return xc.evtchn_alloc_unbound(domid = self.domid,
-                                               remote_dom = 0)
+                                               remote_dom = remote_dom)
         except:
             log.exception("Exception in alloc_unbound(%s)", str(self.domid))
             raise

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel