Coverage for nova/conf/service.py: 83%

6 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-04-17 15:08 +0000

1# needs:check_deprecation_status 

2 

3 

4# Copyright 2015 OpenStack Foundation 

5# All Rights Reserved. 

6# 

7# Licensed under the Apache License, Version 2.0 (the "License"); you may 

8# not use this file except in compliance with the License. You may obtain 

9# a copy of the License at 

10# 

11# http://www.apache.org/licenses/LICENSE-2.0 

12# 

13# Unless required by applicable law or agreed to in writing, software 

14# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 

15# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 

16# License for the specific language governing permissions and limitations 

17# under the License. 

18 

19from oslo_config import cfg 

20 

21service_opts = [ 

22 # TODO(johngarbutt) we need a better default and minimum, in a backwards 

23 # compatible way for report_interval 

24 cfg.IntOpt('report_interval', 

25 default=10, 

26 help=""" 

27Number of seconds indicating how frequently the state of services on a 

28given hypervisor is reported. Nova needs to know this to determine the 

29overall health of the deployment. 

30 

31Related Options: 

32 

33* service_down_time 

34 report_interval should be less than service_down_time. If service_down_time 

35 is less than report_interval, services will routinely be considered down, 

36 because they report in too rarely. 

37"""), 

38 # TODO(johngarbutt) the code enforces the min value here, but we could 

39 # do to add some min value here, once we sort out report_interval 

40 cfg.IntOpt('service_down_time', 

41 default=60, 

42 help=""" 

43Maximum time in seconds since last check-in for up service 

44 

45Each compute node periodically updates their database status based on the 

46specified report interval. If the compute node hasn't updated the status 

47for more than service_down_time, then the compute node is considered down. 

48 

49Related Options: 

50 

51* report_interval (service_down_time should not be less than report_interval) 

52"""), 

53 cfg.BoolOpt('periodic_enable', 

54 default=True, 

55 help=""" 

56Enable periodic tasks. 

57 

58If set to true, this option allows services to periodically run tasks 

59on the manager. 

60 

61In case of running multiple schedulers or conductors you may want to run 

62periodic tasks on only one host - in this case disable this option for all 

63hosts but one. 

64"""), 

65 cfg.IntOpt('periodic_fuzzy_delay', 

66 default=60, 

67 min=0, 

68 help=""" 

69Number of seconds to randomly delay when starting the periodic task 

70scheduler to reduce stampeding. 

71 

72When compute workers are restarted in unison across a cluster, 

73they all end up running the periodic tasks at the same time 

74causing problems for the external services. To mitigate this 

75behavior, periodic_fuzzy_delay option allows you to introduce a 

76random initial delay when starting the periodic task scheduler. 

77 

78Possible Values: 

79 

80* Any positive integer (in seconds) 

81* 0 : disable the random delay 

82"""), 

83 cfg.ListOpt('enabled_apis', 

84 item_type=cfg.types.String(choices=['osapi_compute', 

85 'metadata']), 

86 default=['osapi_compute', 'metadata'], 

87 help="List of APIs to be enabled by default."), 

88 cfg.ListOpt('enabled_ssl_apis', 

89 item_type=cfg.types.String(choices=['osapi_compute', 

90 'metadata']), 

91 default=[], 

92 help=""" 

93List of APIs with enabled SSL. 

94 

95Nova provides SSL support for the API servers. enabled_ssl_apis option 

96allows configuring the SSL support. 

97"""), 

98 cfg.StrOpt('osapi_compute_listen', 

99 default="0.0.0.0", 

100 help=""" 

101IP address on which the OpenStack API will listen. 

102 

103The OpenStack API service listens on this IP address for incoming 

104requests. 

105"""), 

106 cfg.PortOpt('osapi_compute_listen_port', 

107 default=8774, 

108 help=""" 

109Port on which the OpenStack API will listen. 

110 

111The OpenStack API service listens on this port number for incoming 

112requests. 

113"""), 

114 cfg.IntOpt('osapi_compute_workers', 

115 min=1, 

116 help=""" 

117Number of workers for OpenStack API service. The default will be the number 

118of CPUs available. 

119 

120OpenStack API services can be configured to run as multi-process (workers). 

121This overcomes the problem of reduction in throughput when API request 

122concurrency increases. OpenStack API service will run in the specified 

123number of processes. 

124 

125Possible Values: 

126 

127* Any positive integer 

128* None (default value) 

129"""), 

130 cfg.StrOpt('metadata_listen', 

131 default="0.0.0.0", 

132 help=""" 

133IP address on which the metadata API will listen. 

134 

135The metadata API service listens on this IP address for incoming 

136requests. 

137"""), 

138 cfg.PortOpt('metadata_listen_port', 

139 default=8775, 

140 help=""" 

141Port on which the metadata API will listen. 

142 

143The metadata API service listens on this port number for incoming 

144requests. 

145"""), 

146 cfg.IntOpt('metadata_workers', 

147 min=1, 

148 help=""" 

149Number of workers for metadata service. If not specified the number of 

150available CPUs will be used. 

151 

152The metadata service can be configured to run as multi-process (workers). 

153This overcomes the problem of reduction in throughput when API request 

154concurrency increases. The metadata service will run in the specified 

155number of processes. 

156 

157Possible Values: 

158 

159* Any positive integer 

160* None (default value) 

161"""), 

162] 

163 

164 

165def register_opts(conf): 

166 conf.register_opts(service_opts) 

167 

168 

169def list_opts(): 

170 return {'DEFAULT': service_opts}