summaryrefslogtreecommitdiff
path: root/designate/conf/producer.py
blob: 44f5ec7d7ae99ac739f9463af755c625b3751883 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# Author: Endre Karlson <endre.karlson@hpe.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg

PRODUCER_GROUP = cfg.OptGroup(
    name='service:producer',
    title='Configuration for Producer Service'
)

PRODUCER_TASK_DELAYED_NOTIFY_GROUP = cfg.OptGroup(
    name='producer_task:delayed_notify',
    title='Configuration for Producer Task: Delayed Notify'
)

PRODUCER_TASK_PERIODIC_EXISTS_GROUP = cfg.OptGroup(
    name='producer_task:periodic_exists',
    title='Configuration for Producer Task: Periodic Exists'
)

PRODUCER_TASK_PERIODIC_SECONDARY_REFRESH_GROUP = cfg.OptGroup(
    name='producer_task:periodic_secondary_refresh',
    title='Configuration for Producer Task: Periodic Secondary Refresh'
)

PRODUCER_TASK_WORKER_PERIODIC_RECOVERY_GROUP = cfg.OptGroup(
    name='producer_task:worker_periodic_recovery',
    title='Configuration for Producer Task: Worker Periodic Recovery'
)

PRODUCER_TASK_ZONE_PURGE_GROUP = cfg.OptGroup(
    name='producer_task:zone_purge',
    title='Configuration for Producer Task: Zone Purge'
)

PRODUCER_OPTS = [
    cfg.IntOpt('workers',
               help='Number of Producer worker processes to spawn'),
    cfg.IntOpt('threads', default=1000,
               help='Number of Producer greenthreads to spawn'),
    cfg.ListOpt('enabled_tasks',
                help='Enabled tasks to run'),
    cfg.StrOpt('storage_driver', default='sqlalchemy',
               help='The storage driver to use'),
    cfg.BoolOpt('export_synchronous', default=True,
                help='Whether to allow synchronous zone exports',
                deprecated_for_removal=True,
                deprecated_reason='Migrated to designate-worker'),
    cfg.StrOpt('topic', default='producer',
               help='RPC topic name for producer'),
]

PRODUCER_TASK_DELAYED_NOTIFY_OPTS = [
    cfg.IntOpt('interval', default=5,
               help='Run interval in seconds'),
    cfg.IntOpt('per_page', default=100,
               help='Default amount of results returned per page'),
    cfg.IntOpt('batch_size', default=100,
               help='How many zones to receive NOTIFY on each run'),
]

PRODUCER_TASK_PERIODIC_EXISTS_OPTS = [
    cfg.IntOpt('interval', default=3600,
               help='Run interval in seconds'),
    cfg.IntOpt('per_page', default=100,
               help='Default amount of results returned per page'),
]

PRODUCER_TASK_PERIODIC_SECONDARY_REFRESH_OPTS = [
    cfg.IntOpt('interval', default=3600,
               help='Run interval in seconds'),
    cfg.IntOpt('per_page', default=100,
               help='Default amount of results returned per page'),
]

PRODUCER_TASK_WORKER_PERIODIC_RECOVERY_OPTS = [
    cfg.IntOpt('interval', default=120,
               help='Run interval in seconds'),
    cfg.IntOpt('per_page', default=100,
               help='Default amount of results returned per page'),
]

PRODUCER_TASK_ZONE_PURGE_OPTS = [
    cfg.IntOpt('interval', default=3600,
               help='Run interval in seconds'),
    cfg.IntOpt('per_page', default=100,
               help='Default amount of results returned per page'),
    cfg.IntOpt('time_threshold', default=604800,
               help='How old deleted zones should be (deleted_at) to be '
                    'purged, in seconds'),
    cfg.IntOpt('batch_size', default=100,
               help='How many zones to be purged on each run'),
]


def register_opts(conf):
    conf.register_group(PRODUCER_GROUP)
    conf.register_opts(PRODUCER_OPTS, group=PRODUCER_GROUP)
    conf.register_group(PRODUCER_TASK_DELAYED_NOTIFY_GROUP)
    conf.register_opts(PRODUCER_TASK_DELAYED_NOTIFY_OPTS,
                       group=PRODUCER_TASK_DELAYED_NOTIFY_GROUP)
    conf.register_group(PRODUCER_TASK_PERIODIC_EXISTS_GROUP)
    conf.register_opts(PRODUCER_TASK_PERIODIC_EXISTS_OPTS,
                       group=PRODUCER_TASK_PERIODIC_EXISTS_GROUP)
    conf.register_group(PRODUCER_TASK_PERIODIC_SECONDARY_REFRESH_GROUP)
    conf.register_opts(PRODUCER_TASK_PERIODIC_SECONDARY_REFRESH_OPTS,
                       group=PRODUCER_TASK_PERIODIC_SECONDARY_REFRESH_GROUP)
    conf.register_group(PRODUCER_TASK_WORKER_PERIODIC_RECOVERY_GROUP)
    conf.register_opts(PRODUCER_TASK_WORKER_PERIODIC_RECOVERY_OPTS,
                       group=PRODUCER_TASK_WORKER_PERIODIC_RECOVERY_GROUP)
    conf.register_group(PRODUCER_TASK_ZONE_PURGE_GROUP)
    conf.register_opts(PRODUCER_TASK_ZONE_PURGE_OPTS,
                       group=PRODUCER_TASK_ZONE_PURGE_GROUP)


def list_opts():
    return {
        PRODUCER_GROUP: PRODUCER_OPTS,
        PRODUCER_TASK_DELAYED_NOTIFY_GROUP:
            PRODUCER_TASK_DELAYED_NOTIFY_OPTS,
        PRODUCER_TASK_PERIODIC_EXISTS_GROUP:
            PRODUCER_TASK_PERIODIC_EXISTS_OPTS,
        PRODUCER_TASK_PERIODIC_SECONDARY_REFRESH_GROUP:
            PRODUCER_TASK_PERIODIC_SECONDARY_REFRESH_OPTS,
        PRODUCER_TASK_WORKER_PERIODIC_RECOVERY_GROUP:
            PRODUCER_TASK_WORKER_PERIODIC_RECOVERY_OPTS,
        PRODUCER_TASK_ZONE_PURGE_GROUP: PRODUCER_TASK_ZONE_PURGE_OPTS,
    }