Beispiel #1
0
    def __init__(self, config_parser):
        ConpaasRequestHandlerComponent.__init__(self)
        self.logger = create_logger(__name__)

        service_type = config_parser.get("agent", "TYPE")
        user_id = config_parser.get("agent", "USER_ID")
        service_id = config_parser.get("agent", "SERVICE_ID")

        self.LOG_FILE = config_parser.get("agent", "LOG_FILE")
        self.ROOT_DIR = "/root"

        self.logger.info("'%s' agent started (uid=%s, sid=%s)" % (service_type, user_id, service_id))

        # IPOP setup
        ipop.configure_conpaas_node(config_parser)

        # Ganglia setup
        self.ganglia = AgentGanglia(config_parser)

        try:
            self.ganglia.configure()
        except Exception, err:
            self.logger.exception("Error configuring Ganglia: %s" % err)
            # Something went wrong while configuring Ganglia. We do not want
            # our agent to think it can be used
            self.ganglia = None
            return
Beispiel #2
0
    def __init__(self, config_parser):
        ConpaasRequestHandlerComponent.__init__(self)

        logger_name = __name__
        self.logfile = config_parser.get('manager', 'LOG_FILE')
        if config_parser.has_option('manager', 'SERVICE_ID'):
            service_id = config_parser.get('manager', 'SERVICE_ID')
            logger_name = logger_name.replace('manager', 'manager%s' % service_id)
            self.logger = create_standalone_logger(logger_name, self.logfile)
        else:
            self.logger = create_logger(logger_name)

        self.config_parser = config_parser
        self.state_log = []
        self.state_set(self.S_INIT)

        self.volumes = {}
        self.nodes = []