Coverage for nova/conf/ironic.py: 92%

12 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-04-24 11:16 +0000

1# Copyright 2015 Intel Corporation 

2# All Rights Reserved. 

3# 

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

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

6# a copy of the License at 

7# 

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

9# 

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

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

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

13# License for the specific language governing permissions and limitations 

14# under the License. 

15 

16from keystoneauth1 import loading as ks_loading 

17from oslo_config import cfg 

18 

19from nova.conf import utils as confutils 

20 

21 

22DEFAULT_SERVICE_TYPE = 'baremetal' 

23 

24ironic_group = cfg.OptGroup( 

25 'ironic', 

26 title='Ironic Options', 

27 help=""" 

28Configuration options for Ironic driver (Bare Metal). 

29If using the Ironic driver following options must be set: 

30 

31* auth_type 

32* auth_url 

33* project_name 

34* username 

35* password 

36* project_domain_id or project_domain_name 

37* user_domain_id or user_domain_name 

38""") 

39 

40ironic_options = [ 

41 cfg.IntOpt( 

42 'api_max_retries', 

43 # TODO(raj_singh): Change this default to some sensible number 

44 default=60, 

45 min=0, 

46 help=""" 

47The number of times to retry when a request conflicts. 

48If set to 0, only try once, no retries. 

49 

50Related options: 

51 

52* api_retry_interval 

53"""), 

54 cfg.IntOpt( 

55 'api_retry_interval', 

56 default=2, 

57 min=0, 

58 help=""" 

59The number of seconds to wait before retrying the request. 

60 

61Related options: 

62 

63* api_max_retries 

64"""), 

65 cfg.IntOpt( 

66 'serial_console_state_timeout', 

67 default=10, 

68 min=0, 

69 help='Timeout (seconds) to wait for node serial console state ' 

70 'changed. Set to 0 to disable timeout.'), 

71 cfg.StrOpt( 

72 'conductor_group', 

73 deprecated_name='partition_key', 

74 default=None, 

75 mutable=True, 

76 max_length=255, 

77 regex=r'^[a-zA-Z0-9_.-]*$', 

78 help='Case-insensitive key to limit the set of nodes that may be ' 

79 'managed by this service to the set of nodes in Ironic which ' 

80 'have a matching conductor_group property. If unset, all ' 

81 'available nodes will be eligible to be managed by this ' 

82 'service. Note that setting this to the empty string (``""``) ' 

83 'will match the default conductor group, and is different than ' 

84 'leaving the option unset.'), 

85 cfg.StrOpt( 

86 'shard', 

87 default=None, 

88 max_length=255, 

89 regex=r'^[a-zA-Z0-9_.-]+$', 

90 help='Specify which ironic shard this nova-compute will manage. ' 

91 'This allows you to shard Ironic nodes between compute ' 

92 'services across conductors and conductor groups. ' 

93 'When a shard is set, the peer_list configuration is ignored. ' 

94 'We require that there is at most one nova-compute service ' 

95 'for each shard.'), 

96 cfg.ListOpt( 

97 'peer_list', 

98 deprecated_for_removal=True, 

99 deprecated_since='28.0.0', 

100 deprecated_reason="""\ 

101 We do not recommend using nova-compute HA, please use passive 

102 failover of a single nova-compute service instead.""", 

103 default=[], 

104 help='List of hostnames for all nova-compute services (including ' 

105 'this host) with this conductor_group config value. ' 

106 'Nodes matching the conductor_group value will be distributed ' 

107 'between all services specified here. ' 

108 'If conductor_group is unset, this option is ignored.'), 

109] 

110 

111 

112def register_opts(conf): 

113 conf.register_group(ironic_group) 

114 conf.register_opts(ironic_options, group=ironic_group) 

115 confutils.register_ksa_opts(conf, ironic_group, DEFAULT_SERVICE_TYPE) 

116 

117 

118def list_opts(): 

119 return {ironic_group: ( 

120 ironic_options + 

121 ks_loading.get_session_conf_options() + 

122 ks_loading.get_auth_common_conf_options() + 

123 ks_loading.get_auth_plugin_conf_options('v3password') + 

124 confutils.get_ksa_adapter_opts(DEFAULT_SERVICE_TYPE)) 

125 }