~ubuntu-branches/ubuntu/raring/nova/raring-proposed

« back to all changes in this revision

Viewing changes to nova/config.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Adam Gandelman, Chuck Short
  • Date: 2012-11-23 09:04:58 UTC
  • mfrom: (1.1.66)
  • Revision ID: package-import@ubuntu.com-20121123090458-91565o7aev1i1h71
Tags: 2013.1~g1-0ubuntu1
[ Adam Gandelman ]
* debian/control: Ensure novaclient is upgraded with nova,
  require python-keystoneclient >= 1:2.9.0. (LP: #1073289)
* debian/patches/{ubuntu/*, rbd-security.patch}: Dropped, applied
  upstream.
* debian/control: Add python-testtools to Build-Depends.

[ Chuck Short ]
* New upstream version.
* Refreshed debian/patches/avoid_setuptools_git_dependency.patch.
* debian/rules: FTBFS if missing binaries.
* debian/nova-scheudler.install: Add missing rabbit-queues and
  nova-rpc-zmq-receiver.
* Remove nova-volume since it doesnt exist anymore, transition to cinder-*.
* debian/rules: install apport hook in the right place.
* debian/patches/ubuntu-show-tests.patch: Display test failures.
* debian/control: Add depends on genisoimage
* debian/control: Suggest guestmount.
* debian/control: Suggest websockify. (LP: #1076442)
* debian/nova.conf: Disable nova-volume service.
* debian/control: Depend on xen-system-* rather than the hypervisor.
* debian/control, debian/mans/nova-conductor.8, debian/nova-conductor.init,
  debian/nova-conductor.install, debian/nova-conductor.logrotate
  debian/nova-conductor.manpages, debian/nova-conductor.postrm
  debian/nova-conductor.upstart.in: Add nova-conductor service.
* debian/control: Add python-fixtures as a build deps.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
 
2
 
 
3
# Copyright 2010 United States Government as represented by the
 
4
# Administrator of the National Aeronautics and Space Administration.
 
5
# All Rights Reserved.
 
6
# Copyright 2012 Red Hat, Inc.
 
7
#
 
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
 
11
#
 
12
#         http://www.apache.org/licenses/LICENSE-2.0
 
13
#
 
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
 
18
#    under the License.
 
19
 
 
20
import os
 
21
import socket
 
22
 
 
23
from nova.openstack.common import cfg
 
24
 
 
25
 
 
26
def _get_my_ip():
 
27
    """
 
28
    Returns the actual ip of the local machine.
 
29
 
 
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.
 
34
    """
 
35
    try:
 
36
        csock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
 
37
        csock.connect(('8.8.8.8', 80))
 
38
        (addr, port) = csock.getsockname()
 
39
        csock.close()
 
40
        return addr
 
41
    except socket.error:
 
42
        return "127.0.0.1"
 
43
 
 
44
 
 
45
core_opts = [
 
46
    cfg.StrOpt('sql_connection',
 
47
               default='sqlite:///$state_path/$sqlite_db',
 
48
               help='The SQLAlchemy connection string used to connect to the '
 
49
                    'database'),
 
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__),
 
55
                                                    '../')),
 
56
               help='Directory where the nova python module is installed'),
 
57
    cfg.StrOpt('bindir',
 
58
               default='$pybasedir/bin',
 
59
               help='Directory where nova binaries are installed'),
 
60
    cfg.StrOpt('state_path',
 
61
               default='$pybasedir',
 
62
               help="Top-level directory for maintaining nova's state"),
 
63
    ]
 
64
 
 
65
debug_opts = [
 
66
    cfg.BoolOpt('fake_network',
 
67
                default=False,
 
68
                help='If passed, use fake network devices and addresses'),
 
69
    cfg.IntOpt('sql_connection_debug',
 
70
               default=0,
 
71
               help='Verbosity of SQL debugging information. 0=None, '
 
72
                    '100=Everything'),
 
73
    cfg.BoolOpt('sql_connection_trace',
 
74
               default=False,
 
75
               help='Add python stack traces to SQL as comment strings'),
 
76
]
 
77
 
 
78
cfg.CONF.register_cli_opts(core_opts)
 
79
cfg.CONF.register_cli_opts(debug_opts)
 
80
 
 
81
global_opts = [
 
82
    cfg.StrOpt('my_ip',
 
83
               default=_get_my_ip(),
 
84
               help='ip address of this host'),
 
85
    cfg.ListOpt('region_list',
 
86
                default=[],
 
87
                help='list of region=fqdn pairs separated by commas'),
 
88
    cfg.StrOpt('aws_access_key_id',
 
89
               default='admin',
 
90
               help='AWS Access ID'),
 
91
    cfg.StrOpt('aws_secret_access_key',
 
92
               default='admin',
 
93
               help='AWS Access Key'),
 
94
    cfg.StrOpt('glance_host',
 
95
               default='$my_ip',
 
96
               help='default glance hostname or ip'),
 
97
    cfg.IntOpt('glance_port',
 
98
               default=9292,
 
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',
 
106
                default=False,
 
107
                help='Allow to perform insecure SSL (https) requests to '
 
108
                     'glance'),
 
109
    cfg.IntOpt('glance_num_retries',
 
110
               default=0,
 
111
               help='Number retries when downloading an image from glance'),
 
112
    cfg.IntOpt('s3_port',
 
113
               default=3333,
 
114
               help='port used when accessing the s3 api'),
 
115
    cfg.StrOpt('s3_host',
 
116
               default='$my_ip',
 
117
               help='hostname or ip for openstack to use when accessing '
 
118
                    'the s3 api'),
 
119
    cfg.StrOpt('cert_topic',
 
120
               default='cert',
 
121
               help='the topic cert nodes listen on'),
 
122
    cfg.StrOpt('compute_topic',
 
123
               default='compute',
 
124
               help='the topic compute nodes listen on'),
 
125
    cfg.StrOpt('console_topic',
 
126
               default='console',
 
127
               help='the topic console proxy nodes listen on'),
 
128
    cfg.StrOpt('scheduler_topic',
 
129
               default='scheduler',
 
130
               help='the topic scheduler nodes listen on'),
 
131
    cfg.StrOpt('network_topic',
 
132
               default='network',
 
133
               help='the topic network nodes listen on'),
 
134
    cfg.BoolOpt('api_rate_limit',
 
135
                default=True,
 
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',
 
141
               default='$my_ip',
 
142
               help='the ip of the ec2 api server'),
 
143
    cfg.StrOpt('ec2_dmz_host',
 
144
               default='$my_ip',
 
145
               help='the internal ip of the ec2 api server'),
 
146
    cfg.IntOpt('ec2_port',
 
147
               default=8773,
 
148
               help='the port of the ec2 api server'),
 
149
    cfg.StrOpt('ec2_scheme',
 
150
               default='http',
 
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',
 
157
                default=[],
 
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',
 
162
                    default=[
 
163
                      'nova.api.openstack.compute.contrib.standard_extensions'
 
164
                      ],
 
165
                    help='osapi compute extension to load'),
 
166
    cfg.StrOpt('osapi_compute_unique_server_name_scope',
 
167
               default='',
 
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',
 
172
               default='/v1.1/',
 
173
               help='the path prefix used to call the openstack api server'),
 
174
    cfg.StrOpt('osapi_compute_link_prefix',
 
175
               default=None,
 
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',
 
179
               default=None,
 
180
               help='Base URL that will be presented to users in links '
 
181
                    'to glance resources'),
 
182
    cfg.IntOpt('osapi_max_limit',
 
183
               default=1000,
 
184
               help='the maximum number of items returned in a single '
 
185
                    'response from a collection resource'),
 
186
    cfg.StrOpt('metadata_host',
 
187
               default='$my_ip',
 
188
               help='the ip for the metadata api server'),
 
189
    cfg.IntOpt('metadata_port',
 
190
               default=8775,
 
191
               help='the port for the metadata api port'),
 
192
    cfg.StrOpt('default_image',
 
193
               default='ami-11111',
 
194
               help='default image to use, testing only'),
 
195
    cfg.StrOpt('default_instance_type',
 
196
               default='m1.small',
 
197
               help='default instance type to use, testing only'),
 
198
    cfg.StrOpt('null_kernel',
 
199
               default='nokernel',
 
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',
 
203
               default='0',
 
204
               help='image id used when starting up a cloudpipe vpn server'),
 
205
    cfg.StrOpt('vpn_key_suffix',
 
206
               default='-vpn',
 
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',
 
212
                default=True,
 
213
                help='If passed, use synchronous mode for sqlite'),
 
214
    cfg.IntOpt('sql_idle_timeout',
 
215
               default=3600,
 
216
               help='timeout before idle sql connections are reaped'),
 
217
    cfg.IntOpt('sql_max_retries',
 
218
               default=10,
 
219
               help='maximum db connection retries during startup. '
 
220
                    '(setting -1 implies an infinite retry count)'),
 
221
    cfg.IntOpt('sql_retry_interval',
 
222
               default=10,
 
223
               help='interval between retries of opening a sql connection'),
 
224
    cfg.IntOpt('sql_max_pool_size',
 
225
               default=5,
 
226
               help='Maximum number of SQL connections to keep open in a '
 
227
                     'pool'),
 
228
    cfg.IntOpt('sql_max_overflow',
 
229
               default=None,
 
230
               help='If set, use this value for max_overflow with '
 
231
                    'sqlalchemy'),
 
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',
 
245
               default='',
 
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'),
 
256
    cfg.StrOpt('host',
 
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',
 
264
               default='nova',
 
265
               help='availability zone of this node'),
 
266
    cfg.ListOpt('memcached_servers',
 
267
                default=None,
 
268
                help='Memcached servers or None for in process cache.'),
 
269
    cfg.StrOpt('instance_usage_audit_period',
 
270
               default='month',
 
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',
 
274
               default=600,
 
275
               help='interval to pull bandwidth usage info'),
 
276
    cfg.BoolOpt('start_guests_on_host_boot',
 
277
                default=False,
 
278
                help='Whether to restart guests when the host reboots'),
 
279
    cfg.BoolOpt('resume_guests_state_on_host_boot',
 
280
                default=False,
 
281
                help='Whether to start guests that were running before the '
 
282
                     'host rebooted'),
 
283
    cfg.StrOpt('default_ephemeral_format',
 
284
               default=None,
 
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',
 
295
                default=False,
 
296
                help='use ipv6'),
 
297
    cfg.BoolOpt('enable_instance_password',
 
298
                default=True,
 
299
                help='Allows use of instance password during '
 
300
                     'server creation'),
 
301
    cfg.IntOpt('password_length',
 
302
               default=12,
 
303
               help='Length of generated instance admin passwords'),
 
304
    cfg.BoolOpt('monkey_patch',
 
305
                default=False,
 
306
                help='Whether to log monkey patching'),
 
307
    cfg.ListOpt('monkey_patch_modules',
 
308
                default=[
 
309
                  'nova.api.ec2.cloud:nova.notifier.api.notify_decorator',
 
310
                  'nova.compute.api:nova.notifier.api.notify_decorator'
 
311
                  ],
 
312
                help='List of modules/decorators to monkey patch'),
 
313
    cfg.BoolOpt('allow_resize_to_same_host',
 
314
                default=False,
 
315
                help='Allow destination machine to match source for resize. '
 
316
                     'Useful when testing in single-host environments.'),
 
317
    cfg.IntOpt('reclaim_instance_interval',
 
318
               default=0,
 
319
               help='Interval in seconds for reclaiming deleted instances'),
 
320
    cfg.IntOpt('zombie_instance_updated_at_window',
 
321
               default=172800,
 
322
               help='Number of seconds zombie instances are cleaned up.'),
 
323
    cfg.IntOpt('service_down_time',
 
324
               default=60,
 
325
               help='maximum time since last check-in for up service'),
 
326
    cfg.StrOpt('default_schedule_zone',
 
327
               default=None,
 
328
               help='availability zone to use when user doesn\'t specify one'),
 
329
    cfg.ListOpt('isolated_images',
 
330
                default=[],
 
331
                help='Images to run on isolated host'),
 
332
    cfg.ListOpt('isolated_hosts',
 
333
                default=[],
 
334
                help='Host reserved for specific images'),
 
335
    cfg.StrOpt('cache_images',
 
336
                default='all',
 
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',
 
342
                default=True,
 
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',
 
357
               default=None,
 
358
               help='Name of network to use to set access ips for instances'),
 
359
    cfg.StrOpt('auth_strategy',
 
360
               default='noauth',
 
361
               help='The strategy to use for auth: noauth or keystone.'),
 
362
    cfg.ListOpt('non_inheritable_image_properties',
 
363
                default=['cache_in_nova',
 
364
                         'bittorrent'],
 
365
                help='These are image properties which a snapshot should not'
 
366
                     ' inherit from an instance'),
 
367
    cfg.BoolOpt('defer_iptables_apply',
 
368
                default=False,
 
369
                help='Whether to batch up the application of IPTables rules'
 
370
                     ' during a host restart and apply all at the end of the'
 
371
                     ' init phase'),
 
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'),
 
377
]
 
378
 
 
379
cfg.CONF.register_opts(global_opts)
 
380
 
 
381
 
 
382
def parse_args(argv, default_config_files=None):
 
383
    cfg.CONF.disable_interspersed_args()
 
384
    return argv[:1] + cfg.CONF(argv[1:],
 
385
                               project='nova',
 
386
                               default_config_files=default_config_files)