Пример #1
0
 def __init__(self):
     LOG.debug("Starting RuntimeAgent.")
     # Get monitor name and service
     conf = SysUtil().get_sys_conf()
     monitor_name = conf.get('monitoring')
     self.monitoring_service = FactoryAgent.get_agent(monitor_name)
     self.policy_threads = {}
     self.heat_client = HeatClient()
     self.checker_threads = {}
Пример #2
0
 def __init__(self):
     self.heatclient = HeatClient()
     conf = SysUtil().get_sys_conf()
     LOG.debug("Get runtime agent: " + conf['runtime_agent'])
     self.runtime_agent = FactoryAgent().get_agent(conf['runtime_agent'])
     #self.register_agent = FactoryAgent().get_agent(conf['register_agent'])
     self.template_manager = FactoryAgent().get_agent(
         conf['template_manager'])
     self.db = FactoryAgent().get_agent(conf['database_manager'])
     self.checker = FactoryAgent().get_agent(conf['checker'])
Пример #3
0
    def __init__(self):
        # self.heatclient = HeatClient()
        conf = SysUtil().get_sys_conf()
        self.template_manager = FactoryAgent().get_agent(conf['template_manager'])
        self.db = FactoryAgent().get_agent(conf['database_manager'])
        self.runtime_agent = FactoryAgent().get_agent(conf['runtime_agent'])

        #self.reg = FactoryAgent().get_agent(file_name=conf['register_agent_file'],
        #                                    class_name=conf['register_agent_class'])
        pass
Пример #4
0
    def __init__(self, conf=None):
        if not conf:
            from util.SysUtil import SysUtil

            self.conf = SysUtil().get_sys_conf()
        else:
            self.conf = conf
        self.nova = client.Client('2',
                                  self.conf['os_username'],
                                  self.conf['os_password'],
                                  self.conf['os_tenant'],
                                  self.conf['os_auth_url'],
                                  region_name=self.conf['os_region_name'])
Пример #5
0
 def __init__(self, topology):
     super(CheckerThread, self).__init__()
     self.heatclient = HeatClient()
     self.topology = topology
     self.db = DatabaseManager()
     self.is_stopped = False
     self.is_dns_configured = False
     self.novac = NovaClient()
     #self.dns_configurator = ImsDnsClient()
     self.neutronc = NeutronClient(
         utilSys.get_endpoint(
             'network',
             region_name=SysUtil().get_sys_conf()['os_region_name']),
         utilSys.get_token())
Пример #6
0
        def __init__(self):
            """
            dialect+driver://username:password@host:port/database
            """

            self.conf = SysUtil().get_sys_conf()
            db_username = self.conf['db_username']
            db_password = self.conf['db_password']
            db_url = self.conf['db_url']
            db_name = self.conf['db_name']

            self.engine = create_engine(
                'sqlite://',
                connect_args={'check_same_thread': False},
                poolclass=StaticPool)
            self._scoped_session = scoped_session(
                sessionmaker(bind=self.engine, expire_on_commit=True))
            self.session = None
Пример #7
0
    def __init__(self, topology, runtime_agent, policy, service_instance,
                 lock):
        super(PolicyThread, self).__init__()
        self.policy = policy
        self.service_instance = service_instance
        self.topology = topology

        self.runtime_agent = runtime_agent
        self.monitor = runtime_agent.monitoring_service
        self.lock = lock

        # hack for avoiding autoscaling at startup
        self.counter = 0
        self.is_stopped = False
        conf = SysUtil().get_sys_conf()
        self.template_manager = FactoryAgent().get_agent(
            conf['template_manager'])
        self.db = FactoryAgent().get_agent(conf['database_manager'])
        self.heat_client = HeatClient()
Пример #8
0
 def run(self):
     LOG.debug("Starting new thread")
     i = 0
     while i < 18:
         for service_instance in self.topology.service_instances:
             for unit in service_instance.units:
                 if i == 0:
                     unit.state = 'Initialised'
                 else:
                     unit.state = 'Started'
                     dbm_name = SysUtil().get_sys_conf()['database_manager']
                     db = FactoryAgent.get_agent(dbm_name)
                     db.update(unit)
                     # conf = SysUtil().get_sys_conf().props
                     # runtime_agent = FactoryAgent().get_agent(conf['runtime_agent'])
                     # runtime_agent.run(self.topology)
             if i > 1:
                 return
         time.sleep(2)
         i += 1
     LOG.error("Can't get info on the units after 180 seconds, is there a problem?")
Пример #9
0
import os
from util.SysUtil import SysUtil
import logging

__author__ = 'lto'

PATH = os.path.abspath(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))

if __name__ == '__main__':
    logging.basicConfig(
        format=
        '%(asctime)s_%(process)d:%(pathname)s:%(lineno)d [%(levelname)s] %(message)s',
        level=logging.DEBUG)
    logger = logging.getLogger("EMMLogger")
    handler = logging.FileHandler('%s/logs/%s.log' %
                                  (PATH, os.path.basename(__file__)))
    handler.setLevel(logging.DEBUG)
    formatter = logging.Formatter(
        '%(asctime)s_%(process)d:%(pathname)s:%(lineno)d [%(levelname)s] %(message)s'
    )
    handler.setFormatter(formatter)
    logger.addHandler(handler)
    sys_util = SysUtil()
    sys_util.init_sys()

    print sys_util.get_sys_conf().props