示例#1
0
 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
 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
 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