예제 #1
0
def getFrontendStatus():
    config = MaxiNetConfig(register=False)
    ip = config.get_nameserver_ip()
    port = config.get_nameserver_port()
    pw = config.get_nameserver_password()
    ns = Pyro4.locateNS(ip, port, hmac_key=pw)
    manager_uri = ns.lookup("MaxiNetManager")
    if (manager_uri):
        manager = Pyro4.Proxy(manager_uri)
        manager._pyroHmacKey = pw
        print manager.print_worker_status()
    else:
        print "Could not contact Frontend server at %s:%s" % (ip, port)
예제 #2
0
파일: server.py 프로젝트: schwabe/MaxiNet
def getFrontendStatus():
    config = MaxiNetConfig(register=False)
    ip = config.get_nameserver_ip()
    port = config.get_nameserver_port()
    pw = config.get_nameserver_password()
    ns = Pyro4.locateNS(ip, port, hmac_key=pw)
    manager_uri = ns.lookup("MaxiNetManager")
    if(manager_uri):
        manager = Pyro4.Proxy(manager_uri)
        manager._pyroHmacKey=pw
        print manager.print_worker_status()
    else:
        print "Could not contact Frontend server at %s:%s" % (ip, port)
예제 #3
0
파일: server.py 프로젝트: schwabe/MaxiNet
def main():
    parser = argparse.ArgumentParser(description="MaxiNet Worker which hosts a mininet instance")
    parser.add_argument("--ip", action="store", help="Frontend Server IP")
    parser.add_argument("--port", action="store", help="Frontend Server Port", type=int)
    parser.add_argument("--password", action="store", help="Frontend Server Password")
    parser.add_argument("-c", "--config", metavar="FILE", action="store", help="Read configuration from FILE")
    parsed = parser.parse_args()

    ip = False
    port = False
    pw = False
    if (parsed.config or
            os.path.isfile("MaxiNet.cfg") or
            os.path.isfile(os.path.expanduser("~/.MaxiNet.cfg")) or
            os.path.isfile("/etc/MaxiNet.cfg")):
        if parsed.config:
            config = MaxiNetConfig(file=parsed.config,register=False)
        else:
            config = MaxiNetConfig(register=False)
        ip = config.get_nameserver_ip()
        port = config.get_nameserver_port()
        pw = config.get_nameserver_password()
    if parsed.ip:
        ip = parsed.ip
    if parsed.port:
        port = parsed.port
    if parsed.password:
        pw = parsed.password

    if os.getuid() != 0:
        print "MaxiNetWorker must run with root privileges!"
        sys.exit(1)

    if not (ip and port and pw):
        print "Please provide MaxiNet.cfg or specify ip, port and password of \
               the Frontend Server."
    else:
        workerserver = WorkerServer()

        signal.signal(signal.SIGINT, workerserver.exit_handler)

        workerserver.start(ip=ip, port=port, password=pw)
        workerserver.monitorFrontend()
예제 #4
0
파일: server.py 프로젝트: tiritor/MaxiNet
    def __init__(self, config=MaxiNetConfig()):
        self.config = config
        self._worker_dict = {}
        self._worker_dict_lock = threading.Lock()
        self._ns = None
        self._pyrodaemon = None
        self.logger = logging.getLogger(__name__)
        self.idents = []

        self._monitor_thread = threading.Thread(target=self.monitor_clusters)
        self._monitor_thread.daemon = True
        self._monitor_thread.start()
예제 #5
0
def main():
    parser = argparse.ArgumentParser(
        description="MaxiNet Worker which hosts a mininet instance")
    parser.add_argument("--ip", action="store", help="Frontend Server IP")
    parser.add_argument("--port",
                        action="store",
                        help="Frontend Server Port",
                        type=int)
    parser.add_argument("--password",
                        action="store",
                        help="Frontend Server Password")
    parser.add_argument("-c",
                        "--config",
                        metavar="FILE",
                        action="store",
                        help="Read configuration from FILE")
    parsed = parser.parse_args()

    ip = False
    port = False
    pw = False
    if (parsed.config or os.path.isfile("MaxiNet.cfg")
            or os.path.isfile(os.path.expanduser("~/.MaxiNet.cfg"))
            or os.path.isfile("/etc/MaxiNet.cfg")):
        if parsed.config:
            config = MaxiNetConfig(file=parsed.config, register=False)
        else:
            config = MaxiNetConfig(register=False)
        ip = config.get_nameserver_ip()
        port = config.get_nameserver_port()
        pw = config.get_nameserver_password()
    if parsed.ip:
        ip = parsed.ip
    if parsed.port:
        port = parsed.port
    if parsed.password:
        pw = parsed.password

    if os.getuid() != 0:
        print "MaxiNetWorker must run with root privileges!"
        sys.exit(1)

    if not (ip and port and pw):
        print "Please provide MaxiNet.cfg or specify ip, port and password of \
               the Frontend Server."

    else:
        workerserver = WorkerServer()

        signal.signal(signal.SIGINT, workerserver.exit_handler)

        workerserver.start(ip=ip, port=port, password=pw)
        workerserver.monitorFrontend()
예제 #6
0
파일: server.py 프로젝트: tiritor/MaxiNet
 def __init__(self, config=MaxiNetConfig()):
     self.config = config
     self.logger = logging.getLogger(__name__)