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
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
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
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)
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))
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))
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)
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)
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
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))
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))
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
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