Esempio n. 1
0
    def sync_zones(self, pool_id, pool_target_id, batch_size):
        pool, target = self._get_config(pool_id, pool_target_id)

        client = impl_akamai.EnhancedDNSClient(target.options.get("username"),
                                               target.options.get("password"))

        LOG.info(_LI("Doing batches of %i") % batch_size)

        criterion = {"pool_id": pool_id}
        marker = None

        # Bug 1519356 - Init policy after configuration has been read
        policy.init()
        self.context.all_tenants = True

        while (marker is not False):
            zones = self.central_api.find_zones(self.context,
                                                criterion,
                                                limit=batch_size,
                                                marker=marker)
            update = []

            if len(zones) == 0:
                LOG.info(_LI("Stopping as there are no more zones."))
                break
            else:
                marker = zones[-1]['id']

            for zone in zones:
                z = impl_akamai.build_zone(client, target, zone)
                update.append(z)

            LOG.info(_LI('Uploading %d Zones') % len(update))

            client.setZones(update)
Esempio n. 2
0
    def _update_zones(self, pool):
        LOG.info("Updating zone masters for pool: {}".format(pool.id))

        def __get_masters_from_pool(pool):
            masters = []
            for target in pool.targets:
                for master in target.get("masters", []):
                    master = {'host': master['host'], 'port': master['port']}
                    found = False
                    for existing_master in masters:
                        if master == existing_master:
                            found = True
                    if not found:
                        masters.append(master)
            return masters

        policy.init()

        self.context.all_tenants = True
        zones = self.central_api.find_zones(self.context,
                                            criterion={'pool_id': pool.id})

        for zone in zones:
            zone.masters = objects.ZoneMasterList().from_list(
                __get_masters_from_pool(pool))
            self.central_api.update_zone(self.context, zone)
Esempio n. 3
0
    def sync_zones(self, pool_id, pool_target_id, batch_size):
        pool, target = self._get_config(pool_id, pool_target_id)

        client = impl_akamai.EnhancedDNSClient(
            target.options.get("username"), target.options.get("password"))

        LOG.info(_LI("Doing batches of %i"), batch_size)

        criterion = {"pool_id": pool_id}
        marker = None

        # Bug 1519356 - Init policy after configuration has been read
        policy.init()
        self.context.all_tenants = True

        while (marker is not False):
            zones = self.central_api.find_zones(
                self.context, criterion, limit=batch_size, marker=marker)
            update = []

            if len(zones) == 0:
                LOG.info(_LI("Stopping as there are no more zones."))
                break
            else:
                marker = zones[-1]['id']

            for zone in zones:
                z = impl_akamai.build_zone(client, target, zone)
                update.append(z)

            LOG.info(_LI('Uploading %d Zones'), len(update))

            client.setZones(update)
Esempio n. 4
0
    def __init__(self, name, threads=None):
        threads = threads or 1000
        super(Service, self).__init__(threads)
        self.name = name
        self.host = CONF.host

        policy.init()

        if not rpc.initialized():
            rpc.init(CONF)
Esempio n. 5
0
    def __init__(self, threads=1000):
        super(Service, self).__init__(threads)

        policy.init()

        # NOTE(kiall): All services need RPC initialized, as this is used
        #              for clients AND servers. Hence, this is common to
        #              all Designate services.
        if not rpc.initialized():
            rpc.init(CONF)
Esempio n. 6
0
    def debug_zone(self, pool_id, target_id, zone_name):
        pool, target = self._get_config(pool_id, target_id)

        client = impl_akamai.EnhancedDNSClient(target.options.get("username"), target.options.get("password"))

        # Bug 1519356 - Init policy after configuration has been read
        policy.init()
        self.context.all_tenants = True

        zone = self.central_api.find_zone(self.context, {"name": zone_name})
        akamai_zone = client.getZone(zone_name)

        print("Designate zone\n%s" % pformat(zone.to_dict()))
        print("Akamai Zone:\n%s" % repr(akamai_zone))
Esempio n. 7
0
    def __init__(self, threads=None):
        threads = threads or 1000

        super(Service, self).__init__(threads)

        self._host = CONF.host
        self._service_config = CONF['service:%s' % self.service_name]

        policy.init()

        # NOTE(kiall): All services need RPC initialized, as this is used
        #              for clients AND servers. Hence, this is common to
        #              all Designate services.
        if not rpc.initialized():
            rpc.init(CONF)
Esempio n. 8
0
    def __init__(self, threads=None):
        threads = threads or 1000

        super(Service, self).__init__(threads)

        self._host = CONF.host
        self._service_config = CONF['service:%s' % self.service_name]

        policy.init()

        # NOTE(kiall): All services need RPC initialized, as this is used
        #              for clients AND servers. Hence, this is common to
        #              all Designate services.
        if not rpc.initialized():
            rpc.init(CONF)
Esempio n. 9
0
    def debug_zone(self, pool_id, target_id, zone_name):
        pool, target = self._get_config(pool_id, target_id)

        client = impl_akamai.EnhancedDNSClient(target.options.get("username"),
                                               target.options.get("password"))

        # Bug 1519356 - Init policy after configuration has been read
        policy.init()
        self.context.all_tenants = True

        zone = self.central_api.find_zone(self.context, {"name": zone_name})
        akamai_zone = client.getZone(zone_name)

        print("Designate zone\n%s" % pformat(zone.to_dict()))
        print("Akamai Zone:\n%s" % repr(akamai_zone))
Esempio n. 10
0
def init_application():
    conf_files = _get_config_files()
    logging.register_options(cfg.CONF)
    cfg.CONF([], project='designate', default_config_files=conf_files)
    config.set_defaults()
    logging.setup(cfg.CONF, 'designate')

    policy.init()

    if not rpc.initialized():
        rpc.init(CONF)

    heartbeat = heartbeat_emitter.get_heartbeat_emitter('api')
    heartbeat.start()

    conf = conf_files[0]

    return deploy.loadapp('config:%s' % conf, name='osapi_dns')
Esempio n. 11
0
def init_application():
    conf_files = _get_config_files()
    logging.register_options(cfg.CONF)
    cfg.CONF([], project='designate', default_config_files=conf_files)
    config.set_defaults()
    logging.setup(cfg.CONF, 'designate')

    policy.init()

    if not rpc.initialized():
        rpc.init(CONF)

    heartbeat = service.Heartbeat('api',
                                  threadgroup.ThreadGroup(thread_pool_size=1))
    heartbeat.start()

    conf = conf_files[0]

    return deploy.loadapp('config:%s' % conf, name='osapi_dns')
Esempio n. 12
0
def main():
    args = parse_args()
    logging.setup('cirrus_floatingip')
    LOG.logger.setLevel('DEBUG')
    load_config(args.config_file)

    kc = keystone_c.Client(username=args.username,
                           password=args.password,
                           tenant_name=args.tenantname,
                           auth_url=args.authurl,
                           endpoint_type=args.endpoint_type,
                           region_name=args.regionname)

    policy.init()
    rpc.init(cfg.CONF)
    context = DesignateContext.get_admin_context(tenant=kc.auth_tenant_id)

    handler = cirrus.CirrusFloatingIPHandler()

    args.func(kc, handler, context, args)
Esempio n. 13
0
    def __init__(self, backlog=128, threads=1000):

        api_paste_config = cfg.CONF['service:api'].api_paste_config
        config_paths = utils.find_config(api_paste_config)

        if len(config_paths) == 0:
            msg = 'Unable to determine appropriate api-paste-config file'
            raise exceptions.ConfigurationError(msg)

        LOG.info('Using api-paste-config found at: %s' % config_paths[0])

        policy.init()

        application = deploy.loadapp("config:%s" % config_paths[0],
                                     name='osapi_dns')

        super(Service, self).__init__(application=application,
                                      host=cfg.CONF['service:api'].api_host,
                                      port=cfg.CONF['service:api'].api_port,
                                      backlog=backlog,
                                      threads=threads)
def main():
    args = parse_args()
    logging.setup('cirrus_floatingip')
    LOG.logger.setLevel('DEBUG')
    load_config(args.config_file)

    kc = keystone_c.Client(
        username=args.username,
        password=args.password,
        tenant_name=args.tenantname,
        auth_url=args.authurl,
        endpoint_type=args.endpoint_type,
        region_name=args.regionname)

    policy.init()
    rpc.init(cfg.CONF)
    context = DesignateContext.get_admin_context(tenant=kc.auth_tenant_id)

    handler = cirrus.CirrusFloatingIPHandler()

    args.func(kc, handler, context, args)
Esempio n. 15
0
    def __init__(self, backlog=128, threads=1000):

        api_paste_config = cfg.CONF['service:api'].api_paste_config
        config_paths = utils.find_config(api_paste_config)

        if len(config_paths) == 0:
            msg = 'Unable to determine appropriate api-paste-config file'
            raise exceptions.ConfigurationError(msg)

        LOG.info(_LI('Using api-paste-config found at: %s') % config_paths[0])

        policy.init()

        application = deploy.loadapp("config:%s" % config_paths[0],
                                     name='osapi_dns')

        super(Service, self).__init__(application=application,
                                      host=cfg.CONF['service:api'].api_host,
                                      port=cfg.CONF['service:api'].api_port,
                                      backlog=backlog,
                                      threads=threads)
Esempio n. 16
0
 def __init__(self):
     self.context = DesignateContext.get_admin_context(
         request_id='designate-manage')
     policy.init()
Esempio n. 17
0
 def __init__(self):
     self.context = DesignateContext.get_admin_context(
         request_id='designate-manage')
     policy.init()