Пример #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
Пример #2
0
    def __init__(self, config_parser):
        self.logger = create_logger(__name__)
        self.state = 'INIT'

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

        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
Пример #3
0
    def __init__(self, config_parser):
        self.logger = create_logger(__name__)    
        self.state = 'INIT'

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

        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
Пример #4
0
 def test_bootstrap_nodes_set(self):
     bootstrap_nodes = 'udp://192.168.122.1:40000\ntcp://192.168.54.3:40001'
     self.config_parser.set('agent', 'IPOP_IP_ADDRESS', '127.0.0.1')
     self.config_parser.set('agent', 'IPOP_BASE_IP', '127.0.0.0')
     self.config_parser.set('agent', 'IPOP_NETMASK', '255.0.0.0')
     self.config_parser.set('agent', 'CONPAAS_HOME', IPOP_CONF_DIR)
     self.config_parser.set('agent', 'IPOP_BOOTSTRAP_NODES', bootstrap_nodes)
     ipop.configure_conpaas_node(self.config_parser)
     dest_file = os.path.join(IPOP_CONF_DIR, 'bootstrap.config')
     expected = ["brunet." + node for node in bootstrap_nodes.split()]
     self._check_bootstrap_nodes(dest_file, expected)
Пример #5
0
 def test_bootstrap_nodes_set(self):
     bootstrap_nodes = 'udp://192.168.122.1:40000\ntcp://192.168.54.3:40001'
     self.config_parser.set('agent', 'IPOP_IP_ADDRESS', '127.0.0.1')
     self.config_parser.set('agent', 'IPOP_BASE_IP', '127.0.0.0')
     self.config_parser.set('agent', 'IPOP_NETMASK', '255.0.0.0')
     self.config_parser.set('agent', 'CONPAAS_HOME', IPOP_CONF_DIR)
     self.config_parser.set('agent', 'IPOP_BOOTSTRAP_NODES',
                            bootstrap_nodes)
     ipop.configure_conpaas_node(self.config_parser)
     dest_file = os.path.join(IPOP_CONF_DIR, 'bootstrap.config')
     expected = ["brunet." + node for node in bootstrap_nodes.split()]
     self._check_bootstrap_nodes(dest_file, expected)
Пример #6
0
    def test_configure_conpaas_node_ipop_not_installed(self):
        # No IPOP_IP_ADDRESS in config_parser, role=agent
        self.assertEquals(None, ipop.configure_conpaas_node(
            self.config_parser))

        # No IPOP_IP_ADDRESS in config_parser, role=manager
        self.assertEquals(None, ipop.configure_conpaas_node(
            config_parser(role='manager')))

        # IPOP not installed
        self.config_parser.set('agent', 'IPOP_IP_ADDRESS', '127.0.0.1')
        self.assertEquals(None, ipop.configure_conpaas_node(
            self.config_parser))
Пример #7
0
    def test_configure_conpaas_node_ipop_not_installed(self):
        # No IPOP_IP_ADDRESS in config_parser, role=agent
        self.assertEquals(None,
                          ipop.configure_conpaas_node(self.config_parser))

        # No IPOP_IP_ADDRESS in config_parser, role=manager
        self.assertEquals(
            None, ipop.configure_conpaas_node(config_parser(role='manager')))

        # IPOP not installed
        self.config_parser.set('agent', 'IPOP_IP_ADDRESS', '127.0.0.1')
        self.assertEquals(None,
                          ipop.configure_conpaas_node(self.config_parser))
Пример #8
0
    def test_bootstrap_nodes_unset(self):
        self.config_parser.set('agent', 'IPOP_IP_ADDRESS', '127.0.0.1')
        self.config_parser.set('agent', 'IPOP_BASE_IP', '127.0.0.0')
        self.config_parser.set('agent', 'IPOP_NETMASK', '255.0.0.0')
        self.config_parser.set('agent', 'CONPAAS_HOME', IPOP_CONF_DIR)
        if (self.config_parser.has_option('agent', 'IPOP_BOOTSTRAP_NODES')):
            self.config_parser.remove_option('agent', 'IPOP_BOOTSTRAP_NODES')
        ipop.configure_conpaas_node(self.config_parser)
        dest_file = os.path.join(IPOP_CONF_DIR, 'bootstrap.config')

        # a few bootstrap nodes from default bootstrap.config file
        expected = ["brunet.tcp://193.136.166.56:49302",
                    "brunet.udp://193.136.166.56:49302",
                    "brunet.udp://169.226.40.4:49302",
                    "brunet.tcp://156.62.231.244:49302",
                    ]
        self._check_bootstrap_nodes(dest_file, expected)
Пример #9
0
    def test_bootstrap_nodes_unset(self):
        self.config_parser.set('agent', 'IPOP_IP_ADDRESS', '127.0.0.1')
        self.config_parser.set('agent', 'IPOP_BASE_IP', '127.0.0.0')
        self.config_parser.set('agent', 'IPOP_NETMASK', '255.0.0.0')
        self.config_parser.set('agent', 'CONPAAS_HOME', IPOP_CONF_DIR)
        if (self.config_parser.has_option('agent', 'IPOP_BOOTSTRAP_NODES')):
            self.config_parser.remove_option('agent', 'IPOP_BOOTSTRAP_NODES')
        ipop.configure_conpaas_node(self.config_parser)
        dest_file = os.path.join(IPOP_CONF_DIR, 'bootstrap.config')

        # a few bootstrap nodes from default bootstrap.config file
        expected = [
            "brunet.tcp://193.136.166.56:49302",
            "brunet.udp://193.136.166.56:49302",
            "brunet.udp://169.226.40.4:49302",
            "brunet.tcp://156.62.231.244:49302",
        ]
        self._check_bootstrap_nodes(dest_file, expected)
Пример #10
0
    def __init__(self, config_parser):
        self.logger = create_logger(__name__)
        self.controller = Controller(config_parser)
        self.logfile = config_parser.get('manager', 'LOG_FILE')
        self.config_parser = config_parser
        self.state = self.S_INIT

        # IPOP setup
        ipop.configure_conpaas_node(config_parser)

        # Ganglia setup
        ganglia = ManagerGanglia(config_parser)

        try:
            ganglia.configure()
        except Exception, err:
            self.logger.exception('Error configuring Ganglia: %s' % err)
            return
Пример #11
0
    def test_configure_conpaas_node_ipop_installed(self):
        self.config_parser.set('agent', 'IPOP_IP_ADDRESS', '127.0.0.1')
        self.config_parser.set('agent', 'IPOP_BASE_IP', '127.0.0.0')
        self.config_parser.set('agent', 'IPOP_NETMASK', '255.0.0.0')

        self.assertEquals(None, ipop.configure_conpaas_node(
            self.config_parser))

        for required_file in ( 'node', 'ipop', 'bootstrap', 'dhcp' ):
            filename = os.path.join(IPOP_CONF_DIR, '%s.config' % required_file)
            self.failUnless(os.path.isfile(filename))
Пример #12
0
    def test_configure_conpaas_node_ipop_installed(self):
        self.config_parser.set('agent', 'IPOP_IP_ADDRESS', '127.0.0.1')
        self.config_parser.set('agent', 'IPOP_BASE_IP', '127.0.0.0')
        self.config_parser.set('agent', 'IPOP_NETMASK', '255.0.0.0')

        self.assertEquals(None,
                          ipop.configure_conpaas_node(self.config_parser))

        for required_file in ('node', 'ipop', 'bootstrap', 'dhcp'):
            filename = os.path.join(IPOP_CONF_DIR, '%s.config' % required_file)
            self.failUnless(os.path.isfile(filename))
Пример #13
0
    def __init__(self, httpsserver, config_parser, **kwargs):
        BaseManager.__init__(self, config_parser)

        # self.controller = Controller(config_parser)
        self.callbacker = DirectorCallbacker(config_parser)
        self.service_id = 0
        self.httpsserver = httpsserver
        self.kwargs = kwargs

        # IPOP setup
        ipop.configure_conpaas_node(config_parser)

        # Ganglia setup
        self.ganglia = ManagerGanglia(config_parser)

        try:
            self.ganglia.configure()
        except Exception, err:
            self.logger.exception('Error configuring Ganglia: %s' % err)
            self.ganglia = None
            return
Пример #14
0
    def __init__(self, config_parser):
        self.logger = create_logger(__name__)
        self.logger.debug('Using libcloud version %s' % libcloud.__version__)

        self.controller = Controller(config_parser)
        self.logfile = config_parser.get('manager', 'LOG_FILE')
        self.config_parser = config_parser
        self.state = self.S_INIT

        self.volumes = []

        # IPOP setup
        ipop.configure_conpaas_node(config_parser)

        # Ganglia setup
        self.ganglia = ManagerGanglia(config_parser)

        try:
            self.ganglia.configure()
        except Exception, err:
            self.logger.exception('Error configuring Ganglia: %s' % err)
            self.ganglia = None
            return
Пример #15
0
    def __init__(self, config_parser):
        self.logger = create_logger(__name__)
        self.logger.debug('Using libcloud version %s' % libcloud.__version__)

        self.controller = Controller(config_parser)
        self.logfile = config_parser.get('manager', 'LOG_FILE')
        self.config_parser = config_parser
        self.state = self.S_INIT

        self.volumes = []

        # IPOP setup
        ipop.configure_conpaas_node(config_parser)

        # Ganglia setup
        self.ganglia = ManagerGanglia(config_parser)

        try:
            self.ganglia.configure()
        except Exception, err:
            self.logger.exception('Error configuring Ganglia: %s' % err)
            self.ganglia = None
            return