Example #1
0
 def generate(self):
     if not CONF.command.tenant:
         tenants = self._storage.get_tenants(CONF.command.begin,
                                             CONF.command.end)
     else:
         tenants = [CONF.command.tenant]
     for tenant in tenants:
         wo = write_orchestrator.WriteOrchestrator(self._output, tenant,
                                                   self._storage,
                                                   CONF.output.basepath)
         wo.init_writing_pipeline()
         if not CONF.command.begin:
             wo.restart_month()
         wo.process()
Example #2
0
    def __init__(self):
        self.keystone = kclient.Client(username=CONF.auth.username,
                                       password=CONF.auth.password,
                                       tenant_name=CONF.auth.tenant,
                                       region_name=CONF.auth.region,
                                       auth_url=CONF.auth.url)

        self.sm = state.DBStateManager(self.keystone.user_id, 'osrtf')

        collector_args = {
            'user': CONF.auth.username,
            'password': CONF.auth.password,
            'tenant': CONF.auth.tenant,
            'region': CONF.auth.region,
            'keystone_url': CONF.auth.url,
            'period': CONF.collect.period
        }
        self.collector = driver.DriverManager(
            COLLECTORS_NAMESPACE,
            CONF.collect.collector,
            invoke_on_load=True,
            invoke_kwds=collector_args).driver

        w_backend = i_utils.import_class(CONF.output.backend)
        self.wo = w_orch.WriteOrchestrator(w_backend,
                                           self.keystone.user_id,
                                           self.sm,
                                           basepath=CONF.output.basepath)

        # Billing processors
        self.b_processors = {}
        self._load_billing_processors()

        # Output settings
        output_pipeline = named.NamedExtensionManager(WRITERS_NAMESPACE,
                                                      CONF.output.pipeline)
        for writer in output_pipeline:
            self.wo.add_writer(writer.plugin)

        # RPC
        self.server = None
        self._billing_endpoint = BillingEndpoint(self)
        self._init_messaging()
Example #3
0
    def __init__(self):
        self.keystone = kclient.Client(username=CONF.auth.username,
                                       password=CONF.auth.password,
                                       tenant_name=CONF.auth.tenant,
                                       region_name=CONF.auth.region,
                                       auth_url=CONF.auth.url)

        s_backend = i_utils.import_class(CONF.state.backend)
        self.sm = state.DBStateManager(self.keystone.user_id, 'osrtf')

        collector_args = {
            'user': CONF.auth.username,
            'password': CONF.auth.password,
            'tenant': CONF.auth.tenant,
            'region': CONF.auth.region,
            'keystone_url': CONF.auth.url,
            'period': CONF.collect.period
        }
        self.collector = driver.DriverManager(
            'cloudkitty.collector.backends',
            CONF.collect.collector,
            invoke_on_load=True,
            invoke_kwds=collector_args).driver

        w_backend = i_utils.import_class(CONF.output.backend)
        self.wo = w_orch.WriteOrchestrator(w_backend, s_backend,
                                           self.keystone.user_id, self.sm)

        # Billing processors
        self.b_processors = {}
        self._load_billing_processors()

        # Output settings
        output_pipeline = named.NamedExtensionManager(
            'cloudkitty.output.writers', CONF.output.pipeline)
        for writer in output_pipeline:
            self.wo.add_writer(writer.plugin)