ia64/xen-unstable
changeset 6886:3233e7ecfa9f
merge?
line diff
1.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32 Wed Sep 14 18:00:23 2005 -0600 1.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32 Thu Sep 15 07:38:53 2005 +0000 1.3 @@ -372,7 +372,7 @@ CONFIG_PNP=y 1.4 # 1.5 CONFIG_ISAPNP=y 1.6 # CONFIG_PNPBIOS is not set 1.7 -CONFIG_PNPACPI=y 1.8 +# CONFIG_PNPACPI is not set 1.9 1.10 # 1.11 # Block devices
2.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/mmu_context.h Wed Sep 14 18:00:23 2005 -0600 2.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/mmu_context.h Thu Sep 15 07:38:53 2005 +0000 2.3 @@ -35,7 +35,7 @@ static inline void __prepare_arch_switch 2.4 * of cr3/ldt (i.e., not in __switch_to). 2.5 */ 2.6 __asm__ __volatile__ ( 2.7 - "movl %%es,%0 ; movl %%ds,%1 ; movl %%fs,%2 ; movl %%gs,%3" 2.8 + "mov %%es,%0 ; mov %%ds,%1 ; mov %%fs,%2 ; mov %%gs,%3" 2.9 : "=m" (current->thread.es), 2.10 "=m" (current->thread.ds), 2.11 "=m" (current->thread.fsindex),
3.1 --- a/tools/misc/xend Wed Sep 14 18:00:23 2005 -0600 3.2 +++ b/tools/misc/xend Thu Sep 15 07:38:53 2005 +0000 3.3 @@ -86,9 +86,6 @@ def main(): 3.4 daemon = SrvDaemon.instance() 3.5 if not sys.argv[1:]: 3.6 print 'usage: %s {start|stop|restart}' % sys.argv[0] 3.7 - elif os.fork(): 3.8 - pid, status = os.wait() 3.9 - return status >> 8 3.10 elif sys.argv[1] == 'start': 3.11 start_xenstored() 3.12 start_consoled()
4.1 --- a/tools/python/xen/lowlevel/xc/xc.c Wed Sep 14 18:00:23 2005 -0600 4.2 +++ b/tools/python/xen/lowlevel/xc/xc.c Thu Sep 15 07:38:53 2005 +0000 4.3 @@ -220,6 +220,9 @@ static PyObject *pyxc_domain_getinfo(PyO 4.4 return PyErr_NoMemory(); 4.5 4.6 nr_doms = xc_domain_getinfo(xc->xc_handle, first_dom, max_doms, info); 4.7 + 4.8 + if (nr_doms < 0) 4.9 + return PyErr_SetFromErrno(xc_error); 4.10 4.11 list = PyList_New(nr_doms); 4.12 for ( i = 0 ; i < nr_doms; i++ )
5.1 --- a/tools/python/xen/web/httpserver.py Wed Sep 14 18:00:23 2005 -0600 5.2 +++ b/tools/python/xen/web/httpserver.py Thu Sep 15 07:38:53 2005 +0000 5.3 @@ -273,6 +273,9 @@ class HttpServer: 5.4 self.interface = interface 5.5 self.port = port 5.6 self.root = root 5.7 + # ready indicates when we are ready to begin accept connections 5.8 + # it should be set after a successful bind 5.9 + self.ready = False 5.10 5.11 def getRoot(self): 5.12 return self.root 5.13 @@ -283,6 +286,7 @@ class HttpServer: 5.14 def run(self): 5.15 self.bind() 5.16 self.listen() 5.17 + self.ready = True 5.18 self.requestLoop() 5.19 5.20 def stop(self):
6.1 --- a/tools/python/xen/web/tcp.py Wed Sep 14 18:00:23 2005 -0600 6.2 +++ b/tools/python/xen/web/tcp.py Thu Sep 15 07:38:53 2005 +0000 6.3 @@ -18,6 +18,7 @@ 6.4 import sys 6.5 import socket 6.6 import types 6.7 +import time 6.8 6.9 from connection import * 6.10 from protocol import * 6.11 @@ -35,8 +36,25 @@ class TCPListener(SocketListener): 6.12 def createSocket(self): 6.13 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 6.14 sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) 6.15 - addr = (self.interface, self.port) 6.16 - sock.bind(addr) 6.17 + 6.18 + # SO_REUSEADDR does not always ensure that we do not get an address 6.19 + # in use error when restarted quickly 6.20 + # we implement a timeout to try and avoid failing unnecessarily 6.21 + 6.22 + timeout = time.time() + 30 6.23 + again = True 6.24 + while again and time.time() < timeout: 6.25 + again = False 6.26 + try: 6.27 + sock.bind((self.interface, self.port)) 6.28 + except socket.error, (errno, strerrno): 6.29 + if errno == 98: 6.30 + again = True 6.31 + else: 6.32 + raise socket.error(errno, strerrno) 6.33 + if again: 6.34 + raise socket.error(98, "address in use") 6.35 + 6.36 return sock 6.37 6.38 def acceptConnection(self, sock, protocol, addr):
7.1 --- a/tools/python/xen/xend/XendDomainInfo.py Wed Sep 14 18:00:23 2005 -0600 7.2 +++ b/tools/python/xen/xend/XendDomainInfo.py Thu Sep 15 07:38:53 2005 +0000 7.3 @@ -110,9 +110,13 @@ def dom_get(dom): 7.4 @param dom: domain id 7.5 @return: info or None 7.6 """ 7.7 - domlist = xc.domain_getinfo(dom, 1) 7.8 - if domlist and dom == domlist[0]['dom']: 7.9 - return domlist[0] 7.10 + try: 7.11 + domlist = xc.domain_getinfo(dom, 1) 7.12 + if domlist and dom == domlist[0]['dom']: 7.13 + return domlist[0] 7.14 + except Exception, err: 7.15 + # ignore missing domain 7.16 + log.exception("domain_getinfo(%d) failed, ignoring", dom) 7.17 return None 7.18 7.19 class XendDomainInfo: 7.20 @@ -349,7 +353,12 @@ class XendDomainInfo: 7.21 def update(self, info=None): 7.22 """Update with info from xc.domain_getinfo(). 7.23 """ 7.24 - self.info = info or dom_get(self.domid) 7.25 + if info: 7.26 + self.info = info 7.27 + else: 7.28 + di = dom_get(self.domid) 7.29 + if not di: 7.30 + return 7.31 self.memory = self.info['mem_kb'] / 1024 7.32 self.ssidref = self.info['ssidref'] 7.33
8.1 --- a/tools/python/xen/xend/server/SrvDaemon.py Wed Sep 14 18:00:23 2005 -0600 8.2 +++ b/tools/python/xen/xend/server/SrvDaemon.py Thu Sep 15 07:38:53 2005 +0000 8.3 @@ -137,13 +137,6 @@ class Daemon: 8.4 else: 8.5 return 0 8.6 8.7 - def onSIGCHLD(self, signum, frame): 8.8 - if self.child > 0: 8.9 - try: 8.10 - pid, sts = os.waitpid(self.child, os.WNOHANG) 8.11 - except os.error, ex: 8.12 - pass 8.13 - 8.14 def fork_pid(self, pidfile): 8.15 """Fork and write the pid of the child to 'pidfile'. 8.16 8.17 @@ -200,15 +193,29 @@ class Daemon: 8.18 # Trying to run an already-running service is a success. 8.19 return 0 8.20 8.21 - signal.signal(signal.SIGCHLD, self.onSIGCHLD) 8.22 + ret = 0 8.23 + 8.24 + # we use a pipe to communicate between the parent and the child process 8.25 + # this way we know when the child has actually initialized itself so 8.26 + # we can avoid a race condition during startup 8.27 + 8.28 + r,w = os.pipe() 8.29 if self.fork_pid(XEND_PID_FILE): 8.30 - #Parent. Sleep to give child time to start. 8.31 - time.sleep(1) 8.32 + os.close(w) 8.33 + r = os.fdopen(r, 'r') 8.34 + s = r.read() 8.35 + r.close() 8.36 + if not len(s): 8.37 + ret = 1 8.38 + else: 8.39 + ret = int(s) 8.40 else: 8.41 + os.close(r) 8.42 # Child 8.43 self.tracing(trace) 8.44 - self.run() 8.45 - return 0 8.46 + self.run(os.fdopen(w, 'w')) 8.47 + 8.48 + return ret 8.49 8.50 def tracing(self, traceon): 8.51 """Turn tracing on or off. 8.52 @@ -290,7 +297,7 @@ class Daemon: 8.53 def stop(self): 8.54 return self.cleanup(kill=True) 8.55 8.56 - def run(self): 8.57 + def run(self, status): 8.58 _enforce_dom0_cpus() 8.59 try: 8.60 log.info("Xend Daemon started") 8.61 @@ -298,12 +305,14 @@ class Daemon: 8.62 relocate.listenRelocation() 8.63 servers = SrvServer.create() 8.64 self.daemonize() 8.65 - servers.start() 8.66 + servers.start(status) 8.67 except Exception, ex: 8.68 print >>sys.stderr, 'Exception starting xend:', ex 8.69 if XEND_DEBUG: 8.70 traceback.print_exc() 8.71 log.exception("Exception starting xend (%s)" % ex) 8.72 + status.write('1') 8.73 + status.close() 8.74 self.exit(1) 8.75 8.76 def exit(self, rc=0):
9.1 --- a/tools/python/xen/xend/server/SrvServer.py Wed Sep 14 18:00:23 2005 -0600 9.2 +++ b/tools/python/xen/xend/server/SrvServer.py Thu Sep 15 07:38:53 2005 +0000 9.3 @@ -48,6 +48,7 @@ from xen.xend import XendRoot; xroot = X 9.4 from xen.xend import Vifctl 9.5 from xen.xend.XendLogging import log 9.6 from xen.web.SrvDir import SrvDir 9.7 +import time 9.8 9.9 from SrvRoot import SrvRoot 9.10 9.11 @@ -59,7 +60,7 @@ class XendServers: 9.12 def add(self, server): 9.13 self.servers.append(server) 9.14 9.15 - def start(self): 9.16 + def start(self, status): 9.17 Vifctl.network('start') 9.18 threads = [] 9.19 for server in self.servers: 9.20 @@ -67,6 +68,25 @@ class XendServers: 9.21 thread.start() 9.22 threads.append(thread) 9.23 9.24 + 9.25 + # check for when all threads have initialized themselves and then 9.26 + # close the status pipe 9.27 + 9.28 + threads_left = True 9.29 + while threads_left: 9.30 + threads_left = False 9.31 + 9.32 + for server in self.servers: 9.33 + if not server.ready: 9.34 + threads_left = True 9.35 + break 9.36 + 9.37 + if threads_left: 9.38 + time.sleep(.5) 9.39 + 9.40 + status.write('0') 9.41 + status.close() 9.42 + 9.43 for t in threads: 9.44 t.join() 9.45