take down the -s (startingup) option
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 25 Jun 2010 13:58:00 +0000 (13:58 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 25 Jun 2010 13:58:00 +0000 (13:58 +0000)
accounts.py
initscripts/nm
nodemanager.py
slivermanager.py

index 4357b8b..a9461d1 100644 (file)
@@ -33,8 +33,6 @@ import logger
 import tools
 
 
-# When this variable is true, start after any ensure_created
-Startingup = False
 # shell path -> account class association
 shell_acct_class = {}
 # account type -> account class association
@@ -130,7 +128,7 @@ class Worker:
         self.name = name  # username
         self._acct = None  # the account object currently associated with this worker
 
-    def ensure_created(self, rec, startingup = Startingup):
+    def ensure_created(self, rec):
         """Check account type is still valid.  If not, recreate sliver.
 If still valid, check if running and configure/start if not."""
         logger.log_data_in_file(rec,"/var/lib/nodemanager/%s.rec.txt"%rec['name'],
@@ -143,7 +141,8 @@ If still valid, check if running and configure/start if not."""
             try: next_class.create(self.name, rec['vref'])
             finally: create_sem.release()
         if not isinstance(self._acct, next_class): self._acct = next_class(rec)
-        if not self.is_running() or startingup or next_class != curr_class:
+        logger.verbose("accounts.ensure_created: %s, running=%r"%(self.name,self.is_running()))
+        if not self.is_running() or next_class != curr_class:
             self.start(rec)
         else: self._acct.configure(rec)
 
index 2d5e024..15ddefe 100755 (executable)
 
 [ -f /etc/sysconfig/nodemanager ] && . /etc/sysconfig/nodemanager
 
-options=${OPTIONS-"-d -s"}
-restartoptions=${RESTARTOPTIONS-"-d"}
+options=${OPTIONS-"-d"}
 # turn on verbosity
 verboseoptions=${DEBUGOPTIONS-"-v -d"}
-# debug mode is interactive, and has faster period
+# debug mode is interactive, and has faster period 
+# run in deamon mode with service nm restardebug -d
 debugoptions=${DEBUGOPTIONS-"-v -p 30 -r 15"}
 
 nodemanager=${NODEMANAGER-"python /usr/share/NodeManager/nodemanager.py"}
@@ -49,11 +49,11 @@ case "$1" in
     restart|reload)
        shift
        stop
-       start $restartoptions "$@"
+       start $options "$@"
        ;;
     condrestart)
        shift
-       [ -f ${pidfile} ] && { stop; start $restartoptions "$@"; }
+       [ -f ${pidfile} ] && { stop; start $options "$@"; }
        ;;
     restartverbose)
        shift
index 92b77ae..09bb3bb 100755 (executable)
@@ -51,8 +51,6 @@ class NodeManager:
         parser = optparse.OptionParser()
         parser.add_option('-d', '--daemon', action='store_true', dest='daemon', default=False,
                           help='run daemonized')
-        parser.add_option('-s', '--startup', action='store_true', dest='startup', default=False,
-                          help='run all sliver startup scripts')
         parser.add_option('-f', '--config', action='store', dest='config', default='/etc/planetlab/plc_config',
                           help='PLC configuration file')
         parser.add_option('-k', '--session', action='store', dest='session', default='/etc/planetlab/session',
index d2d6131..f69fa74 100644 (file)
@@ -145,7 +145,6 @@ def GetSlivers(data, config = None, plc=None, fullupdate=True):
     if fullupdate: database.db.set_min_timestamp(data['timestamp'])
     # slivers are created here.
     database.db.sync()
-    accounts.Startingup = False
 
 def deliver_ticket(data):
     return GetSlivers(data, fullupdate=False)
@@ -156,7 +155,6 @@ def start(options, config):
 
     accounts.register_class(sliver_vs.Sliver_VS)
     accounts.register_class(controller.Controller)
-    accounts.Startingup = options.startup
     database.start()
     api_calls.deliver_ticket = deliver_ticket
     api.start()