X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=nm.py;fp=nm.py;h=5d89e21a8b52ca401c2ef33b49ed9f98f88b93bf;hb=114082fb689c7b39d66c1041df0256120321fca6;hp=b1bce163160cece7e3f8817515980497635c042a;hpb=af198e0763c05705ba87a1753209b17df38e3f69;p=nodemanager.git diff --git a/nm.py b/nm.py index b1bce16..5d89e21 100644 --- a/nm.py +++ b/nm.py @@ -2,13 +2,13 @@ import optparse import time +import xmlrpclib import accounts import api import database import delegate import logger -import plc import sliver_vs import tools @@ -18,6 +18,18 @@ parser.add_option('-d', '--daemon', action='store_true', dest='daemon', default= parser.add_option('-s', '--startup', action='store_true', dest='startup', default=False, help='run all sliver startup scripts') (options, args) = parser.parse_args() +# XXX - awaiting a real implementation +data = [] +modules = [] + +def GetSlivers(): + for mod in modules: mod.GetSlivers_callback(data) + +def start_and_register_callback(mod): + mod.start() + modules.append(mod) + + def run(): try: if options.daemon: tools.daemon() @@ -27,10 +39,10 @@ def run(): other_pid = tools.pid_file() if other_pid != None: - print """There might be another instance of the node manager running as pid %d. If this is not the case, please remove the pid file %s""" % (other_pid, PID_FILE) + print """There might be another instance of the node manager running as pid %d. If this is not the case, please remove the pid file %s""" % (other_pid, tools.PID_FILE) return - database.start() + start_and_register_callback(database) api.start() while True: try: plc.fetch_and_update()