All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 7/24] [xen-unstable.hg] don't hard code xenstore/console domid when creating evtchns for new domU
@ 2009-03-23 15:20 Alex Zeffertt
  0 siblings, 0 replies; only message in thread
From: Alex Zeffertt @ 2009-03-23 15:20 UTC (permalink / raw)
  To: xen-devel@lists.xensource.com

[-- Attachment #1: Type: text/plain, Size: 2 bytes --]




[-- Attachment #2: xend_var_run_domid --]
[-- Type: text/plain, Size: 2338 bytes --]

This patch implements a way to determine in which domains the console
and xenstore daemons reside. 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. Here, xend is modified to use this mechanism for the
allocated unbound ports.

This patch also make XenDomainInfo use the resulting domids when creating
the xenstore and console channels for a new or resumed domain.

TODO: The patch xend_rename_xenstore_domain moves read_domid to a more
global location. If that patch is kept, this should just create a global
function directly.

A previous version of this patch was sent to xen-devel. See
http://lists.xensource.com/archives/html/xen-devel/2008-07/msg00610.html

Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
---

diff -r 277248efe8ae tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py	Fri Aug 01 16:50:31 2008 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py	Fri Aug 01 16:50:33 2008 +0100
@@ -2501,17 +2501,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



[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-23 15:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-23 15:20 [PATCH 7/24] [xen-unstable.hg] don't hard code xenstore/console domid when creating evtchns for new domU Alex Zeffertt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.