Example #1
0
    def listener_add(self, name, ip, port, protocol, balance, sstricky,
                     cookie_info):
        if LBCO.check_listener_existance(name):
            return [False, 'Listener %s exists' % name]

        if not LBCO.config_listener(name, ip, port, protocol, balance,
                                    sstricky, cookie_info, False):
            log.error('Config listener %s (%s:%d %s %s %s)' %
                      (name, ip, port, balance, sstricky, cookie_info))
            if not LBCO.recovery_listener(name):
                log.error('Recovery listener %s config error' % name)
            return [False, 'Config listener %s error' % name]
        if not LBCO.complete_listener_config(name):
            log.error('Complete listener %s config error' % name)
            return [False, 'Complete listener %s config error' % name]
        return [True, '']
Example #2
0
    def listener_del(self, name):
        if not LBCO.check_listener_existance(name):
            log.error('Listener %s not exists' % name)
            return [True, '']

        if not LBCO.backup_listener_config(name):
            log.error('Backup listener %s config error' % name)
            return [False, 'Backup listener %s config error' % name]
        if not LBCO.delete_listener(name):
            log.error('Del listener %s error' % name)
            if not LBCO.recovery_listener(name):
                log.error('Recovery listener %s config error' % name)
            return [False, 'Del listener %s error' % name]
        if not LBCO.complete_listener_config(name):
            log.error('Complete listener %s config error' % name)
            return [False, 'Complete listener %s config error' % name]
        return [True, '']
Example #3
0
 def listener_config(self, name, ip, port, protocol, balance, sstricky,
                     cookie_info, health_chk, servers_info):
     if not LBCO.backup_listener_config(name):
         log.error('Backup listener %s config error' % name)
         return [False, 'Backup listener %s config error' % name]
     if not LBCO.config_listener(name, ip, port, protocol, balance,
                                 sstricky, cookie_info, health_chk,
                                 servers_info):
         log.error('Config listener %s (%s:%d %s %s %s)' %
                   (name, ip, port, balance, sstricky, cookie_info))
         if not LBCO.recovery_listener(name):
             log.error('Recovery listener %s config error' % name)
         return [False, 'Config listener %s error' % name]
     if not LBCO.complete_listener_config(name, servers_info):
         log.error('Complete listener %s config error' % name)
         return [False, 'Complete listener %s config error' % name]
     return [True, '']
Example #4
0
    def server_enable(self, listener, name):
        if not LBCO.check_listener_existance(listener):
            log.error('Listener %s not exists' % listener)
            return [False, 'Listener %s not exists' % listener]
        if not LBCO.check_server_existance(listener, name):
            log.error('Server %s not exists on listener %s' % (name, listener))
            return [
                False,
                'Server %s not exists on listener %s' % (name, listener)
            ]

        if not LBCO.enable_server(listener, name):
            log.error('Enable listener %s server %s error' % (name, listener))
            return [
                False,
                'Enable listener %s server %s error' % (name, listener)
            ]
        return [True, '']
Example #5
0
    Config.read_conf()
    Config.write_conf()

    if daemon and os.getppid() != 1:
        daemonize()

    signal.signal(signal.SIGTERM, sigterm_handler)

    if os.path.exists('/etc/arch-release'):
        dist = 'arch'

    if dist in ['centos', 'redhat']:
        try:
            from lb_operations import LBCentOSOperations
            from lb_functions import LBCentOSFunctions
            LBCentOSOperations.apply_config()
            server.register_instance(LBCentOSFunctions())
            dist = 'centos-lb'
        except:
            from operations import CentOSOperations
            from functions import CentOSFunctions
            CentOSOperations.apply_config()
            CentOSOperations.init_dns_config()
            server.register_instance(CentOSFunctions())
    elif dist == 'debian':
        from operations import DebianOperations
        from functions import DebianFunctions
        DebianOperations.apply_config()
        DebianOperations.init_dns_config()
        server.register_instance(DebianFunctions())
    elif dist == 'ubuntu':
Example #6
0
    Config.read_conf()
    Config.write_conf()

    if daemon and os.getppid() != 1:
        daemonize()

    signal.signal(signal.SIGTERM, sigterm_handler)
    
    if os.path.exists('/etc/arch-release'):
        dist = 'arch'
    
    if dist in ['centos', 'redhat']:
        try:
            from lb_operations import LBCentOSOperations
            from lb_functions import LBCentOSFunctions
            LBCentOSOperations.apply_config()
            server.register_instance(LBCentOSFunctions())
            dist = 'centos-lb'
        except:
            from operations import CentOSOperations
            from functions import CentOSFunctions
            CentOSOperations.apply_config()
            CentOSOperations.init_dns_config()
            server.register_instance(CentOSFunctions())
    elif dist == 'debian':
        from operations import DebianOperations
        from functions import DebianFunctions
        DebianOperations.apply_config()
        DebianOperations.init_dns_config()
        server.register_instance(DebianFunctions())
    elif dist == 'ubuntu':
Example #7
0
 def listener_clear(self):
     if not LBCO.clear_listener():
         log.error('Clear listener error')
         return [False, 'Clear listener error']
     return [True, '']
Example #8
0
 def listeners_stat_info_get(self):
     return LBCO.get_listeners_stat_info()
Example #9
0
 def servers_health_state_get(self):
     return LBCO.get_servers_health_state_info()