1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
3
# Copyright 2010 United States Government as represented by the
4
# Administrator of the National Aeronautics and Space Administration.
6
# Copyright 2012 Red Hat, Inc.
8
# Licensed under the Apache License, Version 2.0 (the "License"); you may
9
# not use this file except in compliance with the License. You may obtain
10
# a copy of the License at
12
# http://www.apache.org/licenses/LICENSE-2.0
14
# Unless required by applicable law or agreed to in writing, software
15
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17
# License for the specific language governing permissions and limitations
23
from nova.openstack.common import cfg
28
Returns the actual ip of the local machine.
30
This code figures out what source address would be used if some traffic
31
were to be sent out to some well known address on the Internet. In this
32
case, a Google DNS server is used, but the specific address does not
33
matter much. No traffic is actually sent.
36
csock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
37
csock.connect(('8.8.8.8', 80))
38
(addr, port) = csock.getsockname()
46
cfg.StrOpt('sql_connection',
47
default='sqlite:///$state_path/$sqlite_db',
48
help='The SQLAlchemy connection string used to connect to the '
50
cfg.StrOpt('api_paste_config',
51
default="api-paste.ini",
52
help='File name for the paste.deploy config for nova-api'),
53
cfg.StrOpt('pybasedir',
54
default=os.path.abspath(os.path.join(os.path.dirname(__file__),
56
help='Directory where the nova python module is installed'),
58
default='$pybasedir/bin',
59
help='Directory where nova binaries are installed'),
60
cfg.StrOpt('state_path',
62
help="Top-level directory for maintaining nova's state"),
66
cfg.BoolOpt('fake_network',
68
help='If passed, use fake network devices and addresses'),
69
cfg.IntOpt('sql_connection_debug',
71
help='Verbosity of SQL debugging information. 0=None, '
73
cfg.BoolOpt('sql_connection_trace',
75
help='Add python stack traces to SQL as comment strings'),
78
cfg.CONF.register_cli_opts(core_opts)
79
cfg.CONF.register_cli_opts(debug_opts)
84
help='ip address of this host'),
85
cfg.ListOpt('region_list',
87
help='list of region=fqdn pairs separated by commas'),
88
cfg.StrOpt('aws_access_key_id',
90
help='AWS Access ID'),
91
cfg.StrOpt('aws_secret_access_key',
93
help='AWS Access Key'),
94
cfg.StrOpt('glance_host',
96
help='default glance hostname or ip'),
97
cfg.IntOpt('glance_port',
99
help='default glance port'),
100
cfg.ListOpt('glance_api_servers',
101
default=['$glance_host:$glance_port'],
102
help='A list of the glance api servers available to nova. '
103
'Prefix with https:// for ssl-based glance api servers. '
104
'([hostname|ip]:port)'),
105
cfg.BoolOpt('glance_api_insecure',
107
help='Allow to perform insecure SSL (https) requests to '
109
cfg.IntOpt('glance_num_retries',
111
help='Number retries when downloading an image from glance'),
112
cfg.IntOpt('s3_port',
114
help='port used when accessing the s3 api'),
115
cfg.StrOpt('s3_host',
117
help='hostname or ip for openstack to use when accessing '
119
cfg.StrOpt('cert_topic',
121
help='the topic cert nodes listen on'),
122
cfg.StrOpt('compute_topic',
124
help='the topic compute nodes listen on'),
125
cfg.StrOpt('console_topic',
127
help='the topic console proxy nodes listen on'),
128
cfg.StrOpt('scheduler_topic',
130
help='the topic scheduler nodes listen on'),
131
cfg.StrOpt('network_topic',
133
help='the topic network nodes listen on'),
134
cfg.BoolOpt('api_rate_limit',
136
help='whether to rate limit the api'),
137
cfg.ListOpt('enabled_apis',
138
default=['ec2', 'osapi_compute', 'metadata'],
139
help='a list of APIs to enable by default'),
140
cfg.StrOpt('ec2_host',
142
help='the ip of the ec2 api server'),
143
cfg.StrOpt('ec2_dmz_host',
145
help='the internal ip of the ec2 api server'),
146
cfg.IntOpt('ec2_port',
148
help='the port of the ec2 api server'),
149
cfg.StrOpt('ec2_scheme',
151
help='the protocol to use when connecting to the ec2 api '
152
'server (http, https)'),
153
cfg.StrOpt('ec2_path',
154
default='/services/Cloud',
155
help='the path prefix used to call the ec2 api server'),
156
cfg.ListOpt('osapi_compute_ext_list',
158
help='Specify list of extensions to load when using osapi_'
159
'compute_extension option with nova.api.openstack.'
160
'compute.contrib.select_extensions'),
161
cfg.MultiStrOpt('osapi_compute_extension',
163
'nova.api.openstack.compute.contrib.standard_extensions'
165
help='osapi compute extension to load'),
166
cfg.StrOpt('osapi_compute_unique_server_name_scope',
168
help='When set, compute API will consider duplicate hostnames '
169
'invalid within the specified scope, regardless of case. '
170
'Should be empty, "project" or "global".'),
171
cfg.StrOpt('osapi_path',
173
help='the path prefix used to call the openstack api server'),
174
cfg.StrOpt('osapi_compute_link_prefix',
176
help='Base URL that will be presented to users in links '
177
'to the OpenStack Compute API'),
178
cfg.StrOpt('osapi_glance_link_prefix',
180
help='Base URL that will be presented to users in links '
181
'to glance resources'),
182
cfg.IntOpt('osapi_max_limit',
184
help='the maximum number of items returned in a single '
185
'response from a collection resource'),
186
cfg.StrOpt('metadata_host',
188
help='the ip for the metadata api server'),
189
cfg.IntOpt('metadata_port',
191
help='the port for the metadata api port'),
192
cfg.StrOpt('default_image',
194
help='default image to use, testing only'),
195
cfg.StrOpt('default_instance_type',
197
help='default instance type to use, testing only'),
198
cfg.StrOpt('null_kernel',
200
help='kernel image that indicates not to use a kernel, but to '
201
'use a raw disk image instead'),
202
cfg.StrOpt('vpn_image_id',
204
help='image id used when starting up a cloudpipe vpn server'),
205
cfg.StrOpt('vpn_key_suffix',
207
help='Suffix to add to project name for vpn key and secgroups'),
208
cfg.StrOpt('sqlite_db',
209
default='nova.sqlite',
210
help='the filename to use with sqlite'),
211
cfg.BoolOpt('sqlite_synchronous',
213
help='If passed, use synchronous mode for sqlite'),
214
cfg.IntOpt('sql_idle_timeout',
216
help='timeout before idle sql connections are reaped'),
217
cfg.IntOpt('sql_max_retries',
219
help='maximum db connection retries during startup. '
220
'(setting -1 implies an infinite retry count)'),
221
cfg.IntOpt('sql_retry_interval',
223
help='interval between retries of opening a sql connection'),
224
cfg.IntOpt('sql_max_pool_size',
226
help='Maximum number of SQL connections to keep open in a '
228
cfg.IntOpt('sql_max_overflow',
230
help='If set, use this value for max_overflow with '
232
cfg.StrOpt('compute_manager',
233
default='nova.compute.manager.ComputeManager',
234
help='full class name for the Manager for compute'),
235
cfg.StrOpt('console_manager',
236
default='nova.console.manager.ConsoleProxyManager',
237
help='full class name for the Manager for console proxy'),
238
cfg.StrOpt('cert_manager',
239
default='nova.cert.manager.CertManager',
240
help='full class name for the Manager for cert'),
241
cfg.StrOpt('instance_dns_manager',
242
default='nova.network.dns_driver.DNSDriver',
243
help='full class name for the DNS Manager for instance IPs'),
244
cfg.StrOpt('instance_dns_domain',
246
help='full class name for the DNS Zone for instance IPs'),
247
cfg.StrOpt('floating_ip_dns_manager',
248
default='nova.network.dns_driver.DNSDriver',
249
help='full class name for the DNS Manager for floating IPs'),
250
cfg.StrOpt('network_manager',
251
default='nova.network.manager.VlanManager',
252
help='full class name for the Manager for network'),
253
cfg.StrOpt('scheduler_manager',
254
default='nova.scheduler.manager.SchedulerManager',
255
help='full class name for the Manager for scheduler'),
257
default=socket.getfqdn(),
258
help='Name of this node. This can be an opaque identifier. '
259
'It is not necessarily a hostname, FQDN, or IP address. '
260
'However, the node name must be valid within '
261
'an AMQP key, and if using ZeroMQ, a valid '
262
'hostname, FQDN, or IP address'),
263
cfg.StrOpt('node_availability_zone',
265
help='availability zone of this node'),
266
cfg.ListOpt('memcached_servers',
268
help='Memcached servers or None for in process cache.'),
269
cfg.StrOpt('instance_usage_audit_period',
271
help='time period to generate instance usages for. '
272
'Time period must be hour, day, month or year'),
273
cfg.IntOpt('bandwidth_poll_interval',
275
help='interval to pull bandwidth usage info'),
276
cfg.BoolOpt('start_guests_on_host_boot',
278
help='Whether to restart guests when the host reboots'),
279
cfg.BoolOpt('resume_guests_state_on_host_boot',
281
help='Whether to start guests that were running before the '
283
cfg.StrOpt('default_ephemeral_format',
285
help='The default format an ephemeral_volume will be '
286
'formatted with on creation.'),
287
cfg.StrOpt('rootwrap_config',
288
default="/etc/nova/rootwrap.conf",
289
help='Path to the rootwrap configuration file to use for '
290
'running commands as root'),
291
cfg.StrOpt('network_driver',
292
default='nova.network.linux_net',
293
help='Driver to use for network creation'),
294
cfg.BoolOpt('use_ipv6',
297
cfg.BoolOpt('enable_instance_password',
299
help='Allows use of instance password during '
301
cfg.IntOpt('password_length',
303
help='Length of generated instance admin passwords'),
304
cfg.BoolOpt('monkey_patch',
306
help='Whether to log monkey patching'),
307
cfg.ListOpt('monkey_patch_modules',
309
'nova.api.ec2.cloud:nova.notifier.api.notify_decorator',
310
'nova.compute.api:nova.notifier.api.notify_decorator'
312
help='List of modules/decorators to monkey patch'),
313
cfg.BoolOpt('allow_resize_to_same_host',
315
help='Allow destination machine to match source for resize. '
316
'Useful when testing in single-host environments.'),
317
cfg.IntOpt('reclaim_instance_interval',
319
help='Interval in seconds for reclaiming deleted instances'),
320
cfg.IntOpt('zombie_instance_updated_at_window',
322
help='Number of seconds zombie instances are cleaned up.'),
323
cfg.IntOpt('service_down_time',
325
help='maximum time since last check-in for up service'),
326
cfg.StrOpt('default_schedule_zone',
328
help='availability zone to use when user doesn\'t specify one'),
329
cfg.ListOpt('isolated_images',
331
help='Images to run on isolated host'),
332
cfg.ListOpt('isolated_hosts',
334
help='Host reserved for specific images'),
335
cfg.StrOpt('cache_images',
337
help='Cache glance images locally. `all` will cache all'
338
' images, `some` will only cache images that have the'
339
' image_property `cache_in_nova=True`, and `none` turns'
340
' off caching entirely'),
341
cfg.BoolOpt('use_cow_images',
343
help='Whether to use cow images'),
344
cfg.StrOpt('compute_api_class',
345
default='nova.compute.api.API',
346
help='The full class name of the compute API class to use'),
347
cfg.StrOpt('network_api_class',
348
default='nova.network.api.API',
349
help='The full class name of the network API class to use'),
350
cfg.StrOpt('volume_api_class',
351
default='nova.volume.cinder.API',
352
help='The full class name of the volume API class to use'),
353
cfg.StrOpt('security_group_handler',
354
default='nova.network.sg.NullSecurityGroupHandler',
355
help='The full class name of the security group handler class'),
356
cfg.StrOpt('default_access_ip_network_name',
358
help='Name of network to use to set access ips for instances'),
359
cfg.StrOpt('auth_strategy',
361
help='The strategy to use for auth: noauth or keystone.'),
362
cfg.ListOpt('non_inheritable_image_properties',
363
default=['cache_in_nova',
365
help='These are image properties which a snapshot should not'
366
' inherit from an instance'),
367
cfg.BoolOpt('defer_iptables_apply',
369
help='Whether to batch up the application of IPTables rules'
370
' during a host restart and apply all at the end of the'
372
cfg.StrOpt('compute_driver',
373
help='Driver to use for controlling virtualization. Options '
374
'include: libvirt.LibvirtDriver, xenapi.XenAPIDriver, '
375
'fake.FakeDriver, baremetal.BareMetalDriver, '
376
'vmwareapi.VMWareESXDriver'),
379
cfg.CONF.register_opts(global_opts)
382
def parse_args(argv, default_config_files=None):
383
cfg.CONF.disable_interspersed_args()
384
return argv[:1] + cfg.CONF(argv[1:],
386
default_config_files=default_config_files)