* Slices w/ initscripts were starting repeatedly because the flag that signals the...
authorFaiyaz Ahmed <faiyaza@cs.princeton.edu>
Tue, 22 Jul 2008 22:32:01 +0000 (22:32 +0000)
committerFaiyaz Ahmed <faiyaza@cs.princeton.edu>
Tue, 22 Jul 2008 22:32:01 +0000 (22:32 +0000)
accounts.py
sliver_vs.py

index 3413e9c..efac0ad 100644 (file)
@@ -146,8 +146,11 @@ class Worker:
     def _stop(self): self._acct.stop()
 
     def is_running(self): 
-        status = self._acct.is_running()
-        if not status:  logger.verbose("Worker(%s): is not running" % self.name)
+        if self._acct.is_running():
+            status = True
+        else:
+            status = False
+            logger.verbose("Worker(%s): is not running" % self.name)
         return status
 
     def _destroy(self, curr_class):
index 376bf93..8ab08bc 100644 (file)
@@ -163,6 +163,8 @@ class Sliver_VS(accounts.Account, vserver.VServer):
         if self.rspec['enabled'] > 0:
             logger.log('%s: starting in %d seconds' % (self.name, delay))
             time.sleep(delay)
+            # VServer.start calls fork() internally, 
+            # so just close the nonstandard fds and fork once to avoid creating zombies
             child_pid = os.fork()
             if child_pid == 0:
                 if self.initscriptchanged:
@@ -174,14 +176,13 @@ class Sliver_VS(accounts.Account, vserver.VServer):
                         os.close(fd)
                     try:
                         self.chroot_call(install_initscript)
-                        self.initscriptchanged = False
                     except: logger.log_exc(self.name)
-                # VServer.start calls fork() internally, 
-                # so just close the nonstandard fds and fork once to avoid creating zombies
                 tools.close_nonstandard_fds()
                 vserver.VServer.start(self)
                 os._exit(0)
-            else: os.waitpid(child_pid, 0)
+            else: 
+                os.waitpid(child_pid, 0)
+                self.initscriptchanged = False
         else: logger.log('%s: not starting, is not enabled' % self.name)
 
     def stop(self):