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

13 statements  

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

1# Copyright 2016 OpenStack Foundation 

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 oslo_config import cfg 

17 

18vmware_group = cfg.OptGroup('vmware', 

19 title='VMWare Options', 

20 help=""" 

21Related options: 

22Following options must be set in order to launch VMware-based 

23virtual machines. 

24 

25* compute_driver: Must use vmwareapi.VMwareVCDriver. 

26* vmware.host_username 

27* vmware.host_password 

28* vmware.cluster_name 

29""") 

30 

31vmwareapi_vif_opts = [ 

32 cfg.StrOpt('integration_bridge', 

33 help=""" 

34This option should be configured only when using the NSX-MH Neutron 

35plugin. This is the name of the integration bridge on the ESXi server 

36or host. This should not be set for any other Neutron plugin. Hence 

37the default value is not set. 

38 

39Possible values: 

40 

41* Any valid string representing the name of the integration bridge 

42"""), 

43] 

44 

45vmware_utils_opts = [ 

46 cfg.IntOpt('console_delay_seconds', 

47 min=0, 

48 help=""" 

49Set this value if affected by an increased network latency causing 

50repeated characters when typing in a remote console. 

51"""), 

52 # NOTE(takashin): 'serial_port_service_uri' can be non URI format. 

53 # See https://opendev.org/x/vmware-vspc/src/branch/master/README.rst 

54 cfg.StrOpt('serial_port_service_uri', 

55 help=""" 

56Identifies the remote system where the serial port traffic will 

57be sent. 

58 

59This option adds a virtual serial port which sends console output to 

60a configurable service URI. At the service URI address there will be 

61virtual serial port concentrator that will collect console logs. 

62If this is not set, no serial ports will be added to the created VMs. 

63 

64Possible values: 

65 

66* Any valid URI 

67"""), 

68 cfg.URIOpt('serial_port_proxy_uri', 

69 schemes=['telnet', 'telnets'], 

70 help=""" 

71Identifies a proxy service that provides network access to the 

72serial_port_service_uri. 

73 

74Possible values: 

75 

76* Any valid URI (The scheme is 'telnet' or 'telnets'.) 

77 

78Related options: 

79 

80This option is ignored if serial_port_service_uri is not specified. 

81 

82* serial_port_service_uri 

83"""), 

84 cfg.StrOpt('serial_log_dir', 

85 default='/opt/vmware/vspc', 

86 help=""" 

87Specifies the directory where the Virtual Serial Port Concentrator is 

88storing console log files. It should match the 'serial_log_dir' config 

89value of VSPC. 

90"""), 

91] 

92 

93vmwareapi_opts = [ 

94 cfg.HostAddressOpt('host_ip', 

95 help=""" 

96Hostname or IP address for connection to VMware vCenter host."""), 

97 cfg.PortOpt('host_port', 

98 default=443, 

99 help="Port for connection to VMware vCenter host."), 

100 cfg.StrOpt('host_username', 

101 help="Username for connection to VMware vCenter host."), 

102 cfg.StrOpt('host_password', 

103 secret=True, 

104 help="Password for connection to VMware vCenter host."), 

105 cfg.StrOpt('ca_file', 

106 help=""" 

107Specifies the CA bundle file to be used in verifying the vCenter 

108server certificate. 

109"""), 

110 cfg.BoolOpt('insecure', 

111 default=False, 

112 help=""" 

113If true, the vCenter server certificate is not verified. If false, 

114then the default CA truststore is used for verification. 

115 

116Related options: 

117 

118* ca_file: This option is ignored if "ca_file" is set. 

119"""), 

120 cfg.StrOpt('cluster_name', 

121 help="Name of a VMware Cluster ComputeResource."), 

122 cfg.StrOpt('datastore_regex', 

123 help=""" 

124Regular expression pattern to match the name of datastore. 

125 

126The datastore_regex setting specifies the datastores to use with 

127Compute. For example, datastore_regex="nas.*" selects all the data 

128stores that have a name starting with "nas". 

129 

130NOTE: If no regex is given, it just picks the datastore with the 

131most freespace. 

132 

133Possible values: 

134 

135* Any matching regular expression to a datastore must be given 

136"""), 

137 cfg.FloatOpt('task_poll_interval', 

138 default=0.5, 

139 help=""" 

140Time interval in seconds to poll remote tasks invoked on 

141VMware VC server. 

142"""), 

143 cfg.IntOpt('api_retry_count', 

144 min=0, 

145 default=10, 

146 help=""" 

147Number of times VMware vCenter server API must be retried on connection 

148failures, e.g. socket error, etc. 

149"""), 

150 cfg.PortOpt('vnc_port', 

151 default=5900, 

152 help=""" 

153This option specifies VNC starting port. 

154 

155Every VM created by ESX host has an option of enabling VNC client 

156for remote connection. Above option 'vnc_port' helps you to set 

157default starting port for the VNC client. 

158 

159Possible values: 

160 

161* Any valid port number within 5900 -(5900 + vnc_port_total) 

162 

163Related options: 

164 

165Below options should be set to enable VNC client. 

166 

167* vnc.enabled = True 

168* vnc_port_total 

169"""), 

170 cfg.IntOpt('vnc_port_total', 

171 min=0, 

172 default=10000, 

173 help=""" 

174Total number of VNC ports. 

175"""), 

176 cfg.StrOpt('vnc_keymap', 

177 default='en-us', 

178 help=""" 

179Keymap for VNC. 

180 

181The keyboard mapping (keymap) determines which keyboard layout a VNC 

182session should use by default. 

183 

184Possible values: 

185 

186* A keyboard layout which is supported by the underlying hypervisor on 

187 this node. This is usually an 'IETF language tag' (for example 

188 'en-us'). 

189"""), 

190 cfg.BoolOpt('use_linked_clone', 

191 default=True, 

192 help=""" 

193This option enables/disables the use of linked clone. 

194 

195The ESX hypervisor requires a copy of the VMDK file in order to boot 

196up a virtual machine. The compute driver must download the VMDK via 

197HTTP from the OpenStack Image service to a datastore that is visible 

198to the hypervisor and cache it. Subsequent virtual machines that need 

199the VMDK use the cached version and don't have to copy the file again 

200from the OpenStack Image service. 

201 

202If set to false, even with a cached VMDK, there is still a copy 

203operation from the cache location to the hypervisor file directory 

204in the shared datastore. If set to true, the above copy operation 

205is avoided as it creates copy of the virtual machine that shares 

206virtual disks with its parent VM. 

207"""), 

208 cfg.IntOpt('connection_pool_size', 

209 min=10, 

210 default=10, 

211 help=""" 

212This option sets the http connection pool size 

213 

214The connection pool size is the maximum number of connections from nova to 

215vSphere. It should only be increased if there are warnings indicating that 

216the connection pool is full, otherwise, the default should suffice. 

217""") 

218] 

219 

220spbm_opts = [ 

221 cfg.BoolOpt('pbm_enabled', 

222 default=False, 

223 help=""" 

224This option enables or disables storage policy based placement 

225of instances. 

226 

227Related options: 

228 

229* pbm_default_policy 

230"""), 

231 cfg.StrOpt('pbm_wsdl_location', 

232 help=""" 

233This option specifies the PBM service WSDL file location URL. 

234 

235Setting this will disable storage policy based placement 

236of instances. 

237 

238Possible values: 

239 

240* Any valid file path 

241 e.g file:///opt/SDK/spbm/wsdl/pbmService.wsdl 

242"""), 

243 cfg.StrOpt('pbm_default_policy', 

244 help=""" 

245This option specifies the default policy to be used. 

246 

247If pbm_enabled is set and there is no defined storage policy for the 

248specific request, then this policy will be used. 

249 

250Possible values: 

251 

252* Any valid storage policy such as VSAN default storage policy 

253 

254Related options: 

255 

256* pbm_enabled 

257"""), 

258] 

259 

260vmops_opts = [ 

261 cfg.IntOpt('maximum_objects', 

262 min=0, 

263 default=100, 

264 help=""" 

265This option specifies the limit on the maximum number of objects to 

266return in a single result. 

267 

268A positive value will cause the operation to suspend the retrieval 

269when the count of objects reaches the specified limit. The server may 

270still limit the count to something less than the configured value. 

271Any remaining objects may be retrieved with additional requests. 

272"""), 

273 cfg.StrOpt('cache_prefix', 

274 help=""" 

275This option adds a prefix to the folder where cached images are stored 

276 

277This is not the full path - just a folder prefix. This should only be 

278used when a datastore cache is shared between compute nodes. 

279 

280Note: This should only be used when the compute nodes are running on same 

281host or they have a shared file system. 

282 

283Possible values: 

284 

285* Any string representing the cache prefix to the folder 

286""") 

287] 

288 

289ALL_VMWARE_OPTS = (vmwareapi_vif_opts + 

290 vmware_utils_opts + 

291 vmwareapi_opts + 

292 spbm_opts + 

293 vmops_opts) 

294 

295 

296def register_opts(conf): 

297 conf.register_group(vmware_group) 

298 conf.register_opts(ALL_VMWARE_OPTS, group=vmware_group) 

299 

300 

301def list_opts(): 

302 return {vmware_group: ALL_VMWARE_OPTS}