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
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'],
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)
[ -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"}
restart|reload)
shift
stop
- start $restartoptions "$@"
+ start $options "$@"
;;
condrestart)
shift
- [ -f ${pidfile} ] && { stop; start $restartoptions "$@"; }
+ [ -f ${pidfile} ] && { stop; start $options "$@"; }
;;
restartverbose)
shift
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',
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)
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()