コード例 #1
0
ファイル: image.py プロジェクト: Hearen/OnceServer
 def _sentinel_watch(self):
     log.info("waiting for sentinel_fifo")
     try: self.sentinel_fifo.read(1)
     except OSError, e: pass
     self.sentinel_lock.acquire()
     if self.pid:
         try:
             (p,st) = os.waitpid(self.pid, os.WNOHANG)
             if p == self.pid:
                 message = oshelp.waitstatus_description(st)
             else:
                 # obviously it is malfunctioning, kill it now
                 try:
                     os.kill(self.pid, signal.SIGKILL)
                     message = "malfunctioning (closed sentinel), killed"
                 except:
                     message = "malfunctioning or died ?"
             message = "pid %d: %s" % (self.pid, message)
         except Exception, e:
             message = "waitpid failed: %s" % utils.exception_string(e)
         message = "device model failure: %s" % message
         try: message += "; see %s " % self.logfile
         except: pass
         self._dmfailed(message)
         self.pid = None
コード例 #2
0
ファイル: image.py プロジェクト: emechatronics/xen-unstable
 def _sentinel_watch(self):
     log.info("waiting for sentinel_fifo")
     try: self.sentinel_fifo.read(1)
     except OSError, e: pass
     self.sentinel_lock.acquire()
     if self.pid:
         try:
             (p,st) = os.waitpid(self.pid, os.WNOHANG)
             if p == self.pid:
                 message = oshelp.waitstatus_description(st)
             else:
                 # obviously it is malfunctioning, kill it now
                 try:
                     os.kill(self.pid, signal.SIGKILL)
                     message = "malfunctioning (closed sentinel), killed"
                 except:
                     message = "malfunctioning or died ?"
             message = "pid %d: %s" % (self.pid, message)
         except Exception, e:
             message = "waitpid failed: %s" % utils.exception_string(e)
         message = "device model failure: %s" % message
         try: message += "; see %s " % self.logfile
         except: pass
         self._dmfailed(message)
         self.pid = None
コード例 #3
0
ファイル: image.py プロジェクト: astrofimov/vgallium
 def _sentinel_watch(self):
     log.info("waiting for sentinel_fifo")
     try: self.sentinel_fifo.read(1)
     except OSError, e: pass
     self.sentinel_lock.acquire()
     try:
         if self.pid:
             (p,st) = os.waitpid(self.pid, os.WNOHANG)
             if p == self.pid:
                 message = oshelp.waitstatus_description(st)
             else:
                 # obviously it is malfunctioning, kill it now
                 try:
                     os.kill(self.pid, signal.SIGKILL)
                     message = "malfunctioning (closed sentinel), killed"
                 except:
                     message = "malfunctioning or died ?"
             message = "pid %d: %s" % (self.pid, message)
         else:
             message = "no longer running"
     except Exception, e:
         message = "waitpid failed: %s" % utils.exception_string(e)
コード例 #4
0
            self.pid = self.vm.gatherDom(("image/device-model-pid", int))
            log.debug("%s device model rediscovered, pid %s sentinel fifo %s", name, self.pid, sentinel_path_fifo)
            self.sentinel_thread = thread.start_new_thread(self._sentinel_watch, ())

    def _sentinel_watch(self):
        log.info("waiting for sentinel_fifo")
        try:
            self.sentinel_fifo.read(1)
        except OSError, e:
            pass
        self.sentinel_lock.acquire()
        if self.pid:
            try:
                (p, st) = os.waitpid(self.pid, os.WNOHANG)
                if p == self.pid:
                    message = oshelp.waitstatus_description(st)
                else:
                    # obviously it is malfunctioning, kill it now
                    try:
                        os.kill(self.pid, signal.SIGKILL)
                        message = "malfunctioning (closed sentinel), killed"
                    except:
                        message = "malfunctioning or died ?"
                message = "pid %d: %s" % (self.pid, message)
            except Exception, e:
                message = "waitpid failed: %s" % utils.exception_string(e)
            message = "device model failure: %s" % message
            try:
                message += "; see %s " % self.logfile
            except:
                pass
コード例 #5
0
                      name, self.pid, sentinel_path_fifo)
            self.sentinel_thread = thread.start_new_thread(
                self._sentinel_watch, ())

    def _sentinel_watch(self):
        log.info("waiting for sentinel_fifo")
        try:
            self.sentinel_fifo.read(1)
        except OSError, e:
            pass
        self.sentinel_lock.acquire()
        if self.pid:
            try:
                (p, st) = os.waitpid(self.pid, os.WNOHANG)
                if p == self.pid:
                    message = oshelp.waitstatus_description(st)
                else:
                    # obviously it is malfunctioning, kill it now
                    try:
                        os.kill(self.pid, signal.SIGKILL)
                        message = "malfunctioning (closed sentinel), killed"
                    except:
                        message = "malfunctioning or died ?"
                message = "pid %d: %s" % (self.pid, message)
            except Exception, e:
                message = "waitpid failed: %s" % utils.exception_string(e)
            message = "device model failure: %s" % message
            try:
                message += "; see %s " % self.logfile
            except:
                pass