blob: f5f56a8787ef9159f2f7229a780ec97874757e6d [file] [log] [blame]
Jay Pipes3f981df2012-03-27 18:59:44 -04001# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
3# Copyright 2012 OpenStack, LLC
4# All Rights Reserved.
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17
Jay Pipes7f757632011-12-02 15:53:32 -050018import logging
19import os
Attila Fazekas5abb2532012-12-04 11:30:49 +010020import sys
Jay Pipes3f981df2012-03-27 18:59:44 -040021
Matthew Treinish90aedd12013-02-25 17:56:49 -050022from oslo.config import cfg
23
Attila Fazekas3e1b6742013-01-28 16:30:35 +010024from tempest.common.utils.misc import singleton
Jay Pipes7f757632011-12-02 15:53:32 -050025
26LOG = logging.getLogger(__name__)
Daryl Walleck1465d612011-11-02 02:22:15 -050027
Matthew Treinish39e48ef2012-12-21 13:36:15 -050028identity_group = cfg.OptGroup(name='identity',
29 title="Keystone Configuration Options")
Daryl Walleck1465d612011-11-02 02:22:15 -050030
Matthew Treinish39e48ef2012-12-21 13:36:15 -050031IdentityGroup = [
32 cfg.StrOpt('catalog_type',
33 default='identity',
34 help="Catalog type of the Identity service."),
Jay Pipescd8eaec2013-01-16 21:03:48 -050035 cfg.BoolOpt('disable_ssl_certificate_validation',
36 default=False,
37 help="Set to True if using self-signed SSL certificates."),
Jay Pipes7c88eb22013-01-16 21:32:43 -050038 cfg.StrOpt('uri',
39 default=None,
40 help="Full URI of the OpenStack Identity API (Keystone)"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -050041 cfg.StrOpt('strategy',
42 default='keystone',
43 help="Which auth method does the environment use? "
44 "(basic|keystone)"),
45 cfg.StrOpt('region',
Attila Fazekascadcb1f2013-01-21 23:10:53 +010046 default='RegionOne',
Matthew Treinish39e48ef2012-12-21 13:36:15 -050047 help="The identity region name to use."),
Attila Fazekascadcb1f2013-01-21 23:10:53 +010048 cfg.StrOpt('username',
49 default='demo',
50 help="Username to use for Nova API requests."),
51 cfg.StrOpt('tenant_name',
52 default='demo',
53 help="Tenant name to use for Nova API requests."),
54 cfg.StrOpt('password',
55 default='pass',
56 help="API key to use when authenticating.",
57 secret=True),
58 cfg.StrOpt('alt_username',
59 default=None,
60 help="Username of alternate user to use for Nova API "
61 "requests."),
62 cfg.StrOpt('alt_tenant_name',
63 default=None,
64 help="Alternate user's Tenant name to use for Nova API "
65 "requests."),
66 cfg.StrOpt('alt_password',
67 default=None,
68 help="API key to use when authenticating as alternate user.",
69 secret=True),
70 cfg.StrOpt('admin_username',
71 default='admin',
72 help="Administrative Username to use for"
73 "Keystone API requests."),
74 cfg.StrOpt('admin_tenant_name',
75 default='admin',
76 help="Administrative Tenant name to use for Keystone API "
77 "requests."),
78 cfg.StrOpt('admin_password',
79 default='pass',
80 help="API key to use when authenticating as admin.",
81 secret=True),
Matthew Treinish39e48ef2012-12-21 13:36:15 -050082]
Jay Pipes3f981df2012-03-27 18:59:44 -040083
Daryl Walleck1465d612011-11-02 02:22:15 -050084
Matthew Treinish39e48ef2012-12-21 13:36:15 -050085def register_identity_opts(conf):
86 conf.register_group(identity_group)
87 for opt in IdentityGroup:
88 conf.register_opt(opt, group='identity')
Daryl Walleck1465d612011-11-02 02:22:15 -050089
Jay Pipes3f981df2012-03-27 18:59:44 -040090
Matthew Treinish39e48ef2012-12-21 13:36:15 -050091compute_group = cfg.OptGroup(name='compute',
92 title='Compute Service Options')
Rohit Karajgie1b050d2011-12-02 16:13:18 -080093
Matthew Treinish39e48ef2012-12-21 13:36:15 -050094ComputeGroup = [
95 cfg.BoolOpt('allow_tenant_isolation',
96 default=False,
97 help="Allows test cases to create/destroy tenants and "
98 "users. This option enables isolated test cases and "
99 "better parallel execution, but also requires that "
100 "OpenStack Identity API admin credentials are known."),
101 cfg.BoolOpt('allow_tenant_reuse',
102 default=True,
103 help="If allow_tenant_isolation is True and a tenant that "
104 "would be created for a given test already exists (such "
105 "as from a previously-failed run), re-use that tenant "
106 "instead of failing because of the conflict. Note that "
107 "this would result in the tenant being deleted at the "
108 "end of a subsequent successful run."),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500109 cfg.StrOpt('image_ref',
110 default="{$IMAGE_ID}",
111 help="Valid secondary image reference to be used in tests."),
112 cfg.StrOpt('image_ref_alt',
113 default="{$IMAGE_ID_ALT}",
114 help="Valid secondary image reference to be used in tests."),
115 cfg.IntOpt('flavor_ref',
116 default=1,
117 help="Valid primary flavor to use in tests."),
118 cfg.IntOpt('flavor_ref_alt',
119 default=2,
120 help='Valid secondary flavor to be used in tests.'),
121 cfg.BoolOpt('resize_available',
122 default=False,
123 help="Does the test environment support resizing?"),
124 cfg.BoolOpt('live_migration_available',
125 default=False,
126 help="Does the test environment support live migration "
127 "available?"),
128 cfg.BoolOpt('use_block_migration_for_live_migration',
129 default=False,
130 help="Does the test environment use block devices for live "
131 "migration"),
132 cfg.BoolOpt('change_password_available',
133 default=False,
134 help="Does the test environment support changing the admin "
135 "password?"),
136 cfg.BoolOpt('create_image_enabled',
137 default=False,
138 help="Does the test environment support snapshots?"),
139 cfg.IntOpt('build_interval',
140 default=10,
141 help="Time in seconds between build status checks."),
142 cfg.IntOpt('build_timeout',
143 default=300,
144 help="Timeout in seconds to wait for an instance to build."),
145 cfg.BoolOpt('run_ssh',
146 default=False,
147 help="Does the test environment support snapshots?"),
148 cfg.StrOpt('ssh_user',
149 default='root',
150 help="User name used to authenticate to an instance."),
151 cfg.IntOpt('ssh_timeout',
152 default=300,
Chris Yeoh76916042013-02-27 16:25:25 +1030153 help="Timeout in seconds to wait for authentication to "
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500154 "succeed."),
Chris Yeoh76916042013-02-27 16:25:25 +1030155 cfg.IntOpt('ssh_channel_timeout',
156 default=60,
157 help="Timeout in seconds to wait for output from ssh "
158 "channel."),
Attila Fazekasb0661652013-05-08 13:01:36 +0200159 cfg.StrOpt('fixed_network_name',
160 default='private',
161 help="Visible fixed network name "),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500162 cfg.StrOpt('network_for_ssh',
163 default='public',
164 help="Network used for SSH connections."),
165 cfg.IntOpt('ip_version_for_ssh',
166 default=4,
167 help="IP version used for SSH connections."),
168 cfg.StrOpt('catalog_type',
169 default='compute',
170 help="Catalog type of the Compute service."),
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100171 cfg.StrOpt('path_to_private_key',
172 default=None,
173 help="Path to a private key file for SSH access to remote "
174 "hosts"),
175 cfg.BoolOpt('disk_config_enabled_override',
176 default=True,
177 help="If false, skip config tests regardless of the "
178 "extension status"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500179]
Rohit Karajgie1b050d2011-12-02 16:13:18 -0800180
Rohit Karajgie1b050d2011-12-02 16:13:18 -0800181
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500182def register_compute_opts(conf):
183 conf.register_group(compute_group)
184 for opt in ComputeGroup:
185 conf.register_opt(opt, group='compute')
kavan-patil4ea2efb2011-12-09 08:58:50 +0000186
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500187compute_admin_group = cfg.OptGroup(name='compute-admin',
188 title="Compute Admin Options")
donald-ngo7fb1efa2011-12-13 17:17:36 -0800189
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500190ComputeAdminGroup = [
191 cfg.StrOpt('username',
192 default='admin',
193 help="Administrative Username to use for Nova API requests."),
194 cfg.StrOpt('tenant_name',
195 default='admin',
196 help="Administrative Tenant name to use for Nova API "
197 "requests."),
198 cfg.StrOpt('password',
199 default='pass',
200 help="API key to use when authenticating as admin.",
201 secret=True),
202]
Daryl Walleck587385b2012-03-03 13:00:26 -0600203
K Jonathan Harkerd6ba4b42012-12-18 13:50:47 -0800204
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500205def register_compute_admin_opts(conf):
206 conf.register_group(compute_admin_group)
207 for opt in ComputeAdminGroup:
208 conf.register_opt(opt, group='compute-admin')
Daryl Walleck587385b2012-03-03 13:00:26 -0600209
Jay Pipesf38eaac2012-06-21 13:37:35 -0400210
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100211whitebox_group = cfg.OptGroup(name='whitebox',
212 title="Whitebox Options")
213
214WhiteboxGroup = [
215 cfg.BoolOpt('whitebox_enabled',
216 default=False,
217 help="Does the test environment support whitebox tests for "
218 "Compute?"),
219 cfg.StrOpt('db_uri',
220 default=None,
221 help="Connection string to the database of Compute service"),
222 cfg.StrOpt('source_dir',
223 default="/opt/stack/nova",
224 help="Path of nova source directory"),
225 cfg.StrOpt('config_path',
226 default='/etc/nova/nova.conf',
227 help="Path of nova configuration file"),
228 cfg.StrOpt('bin_dir',
229 default="/usr/local/bin/",
230 help="Directory containing nova binaries such as nova-manage"),
231]
232
233
234def register_whitebox_opts(conf):
235 conf.register_group(whitebox_group)
236 for opt in WhiteboxGroup:
237 conf.register_opt(opt, group='whitebox')
238
239
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500240image_group = cfg.OptGroup(name='image',
241 title="Image Service Options")
Jay Pipesf38eaac2012-06-21 13:37:35 -0400242
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500243ImageGroup = [
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500244 cfg.StrOpt('api_version',
245 default='1',
246 help="Version of the API"),
Matthew Treinish72ea4422013-02-07 14:42:49 -0500247 cfg.StrOpt('catalog_type',
248 default='image',
Sean Dague83401992013-05-06 17:46:36 -0400249 help='Catalog type of the Image service.'),
250 cfg.StrOpt('http_image',
251 default='http://download.cirros-cloud.net/0.3.1/'
252 'cirros-0.3.1-x86_64-uec.tar.gz',
253 help='http accessable image')
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500254]
Jay Pipesf38eaac2012-06-21 13:37:35 -0400255
Jay Pipesf38eaac2012-06-21 13:37:35 -0400256
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500257def register_image_opts(conf):
258 conf.register_group(image_group)
259 for opt in ImageGroup:
260 conf.register_opt(opt, group='image')
Jay Pipesf38eaac2012-06-21 13:37:35 -0400261
262
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500263network_group = cfg.OptGroup(name='network',
264 title='Network Service Options')
Daryl Walleck587385b2012-03-03 13:00:26 -0600265
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500266NetworkGroup = [
267 cfg.StrOpt('catalog_type',
268 default='network',
269 help='Catalog type of the Quantum service.'),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500270 cfg.StrOpt('tenant_network_cidr',
271 default="10.100.0.0/16",
272 help="The cidr block to allocate tenant networks from"),
273 cfg.IntOpt('tenant_network_mask_bits',
274 default=29,
275 help="The mask bits for tenant networks"),
276 cfg.BoolOpt('tenant_networks_reachable',
277 default=False,
278 help="Whether tenant network connectivity should be "
279 "evaluated directly"),
280 cfg.StrOpt('public_network_id',
281 default="",
282 help="Id of the public network that provides external "
283 "connectivity"),
284 cfg.StrOpt('public_router_id',
285 default="",
286 help="Id of the public router that provides external "
287 "connectivity"),
Dan Smithd6c1f882013-02-26 15:50:11 -0500288 cfg.BoolOpt('quantum_available',
289 default=False,
290 help="Whether or not quantum is expected to be available"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500291]
Jay Pipes3f981df2012-03-27 18:59:44 -0400292
Jay Pipesf38eaac2012-06-21 13:37:35 -0400293
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500294def register_network_opts(conf):
295 conf.register_group(network_group)
296 for opt in NetworkGroup:
297 conf.register_opt(opt, group='network')
Dan Smithd6ff6b72012-08-23 10:29:41 -0700298
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500299volume_group = cfg.OptGroup(name='volume',
300 title='Block Storage Options')
Daryl Walleck587385b2012-03-03 13:00:26 -0600301
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500302VolumeGroup = [
303 cfg.IntOpt('build_interval',
304 default=10,
305 help='Time in seconds between volume availability checks.'),
306 cfg.IntOpt('build_timeout',
307 default=300,
308 help='Timeout in seconds to wait for a volume to become'
309 'available.'),
310 cfg.StrOpt('catalog_type',
311 default='Volume',
312 help="Catalog type of the Volume Service"),
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100313 cfg.BoolOpt('multi_backend_enabled',
314 default=False,
315 help="Runs Cinder multi-backend test (requires 2 backend)"),
316 cfg.StrOpt('backend1_name',
317 default='LVM_iSCSI',
318 help="Name of the backend1 (must be declared in cinder.conf)"),
319 cfg.StrOpt('backend2_name',
320 default='LVM_iSCSI_1',
321 help="Name of the backend2 (must be declared in cinder.conf)"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500322]
K Jonathan Harkerd6ba4b42012-12-18 13:50:47 -0800323
Daryl Walleck587385b2012-03-03 13:00:26 -0600324
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500325def register_volume_opts(conf):
326 conf.register_group(volume_group)
327 for opt in VolumeGroup:
328 conf.register_opt(opt, group='volume')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200329
Attila Fazekasa23f5002012-10-23 19:32:45 +0200330
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500331object_storage_group = cfg.OptGroup(name='object-storage',
332 title='Object Storage Service Options')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200333
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500334ObjectStoreConfig = [
335 cfg.StrOpt('catalog_type',
336 default='object-store',
337 help="Catalog type of the Object-Storage service."),
nayna-patelb4989b32013-01-09 06:25:13 +0000338 cfg.StrOpt('container_sync_timeout',
339 default=120,
340 help="Number of seconds to time on waiting for a container"
341 "to container synchronization complete."),
342 cfg.StrOpt('container_sync_interval',
343 default=5,
344 help="Number of seconds to wait while looping to check the"
345 "status of a container to container synchronization"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500346]
Attila Fazekasa23f5002012-10-23 19:32:45 +0200347
Attila Fazekasa23f5002012-10-23 19:32:45 +0200348
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500349def register_object_storage_opts(conf):
350 conf.register_group(object_storage_group)
351 for opt in ObjectStoreConfig:
352 conf.register_opt(opt, group='object-storage')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200353
Steve Bakerc60e4e32013-05-06 15:22:41 +1200354
355orchestration_group = cfg.OptGroup(name='orchestration',
356 title='Orchestration Service Options')
357
358OrchestrationGroup = [
359 cfg.StrOpt('catalog_type',
360 default='orchestration',
361 help="Catalog type of the Orchestration service."),
362 cfg.BoolOpt('allow_tenant_isolation',
363 default=False,
364 help="Allows test cases to create/destroy tenants and "
365 "users. This option enables isolated test cases and "
366 "better parallel execution, but also requires that "
367 "OpenStack Identity API admin credentials are known."),
368 cfg.IntOpt('build_interval',
369 default=1,
370 help="Time in seconds between build status checks."),
371 cfg.IntOpt('build_timeout',
372 default=300,
373 help="Timeout in seconds to wait for a stack to build."),
374 cfg.BoolOpt('heat_available',
375 default=False,
376 help="Whether or not Heat is expected to be available"),
377 cfg.StrOpt('instance_type',
378 default='m1.tiny',
379 help="Instance type for tests. Needs to be big enough for a "
380 "full OS plus the test workload"),
381 cfg.StrOpt('image_ref',
382 default=None,
383 help="Name of heat-cfntools enabled image to use when "
384 "launching test instances."),
385 cfg.StrOpt('keypair_name',
386 default=None,
387 help="Name of existing keypair to launch servers with."),
388]
389
390
391def register_orchestration_opts(conf):
392 conf.register_group(orchestration_group)
393 for opt in OrchestrationGroup:
394 conf.register_opt(opt, group='orchestration')
395
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500396boto_group = cfg.OptGroup(name='boto',
397 title='EC2/S3 options')
398BotoConfig = [
399 cfg.StrOpt('ec2_url',
400 default="http://localhost:8773/services/Cloud",
401 help="EC2 URL"),
402 cfg.StrOpt('s3_url',
403 default="http://localhost:8080",
404 help="S3 URL"),
405 cfg.StrOpt('aws_secret',
406 default=None,
407 help="AWS Secret Key",
408 secret=True),
409 cfg.StrOpt('aws_access',
410 default=None,
411 help="AWS Access Key"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500412 cfg.StrOpt('s3_materials_path',
413 default="/opt/stack/devstack/files/images/"
414 "s3-materials/cirros-0.3.0",
415 help="S3 Materials Path"),
416 cfg.StrOpt('ari_manifest',
417 default="cirros-0.3.0-x86_64-initrd.manifest.xml",
418 help="ARI Ramdisk Image manifest"),
419 cfg.StrOpt('ami_manifest',
420 default="cirros-0.3.0-x86_64-blank.img.manifest.xml",
421 help="AMI Machine Image manifest"),
422 cfg.StrOpt('aki_manifest',
423 default="cirros-0.3.0-x86_64-vmlinuz.manifest.xml",
424 help="AKI Kernel Image manifest"),
425 cfg.StrOpt('instance_type',
426 default="m1.tiny",
427 help="Instance type"),
428 cfg.IntOpt('http_socket_timeout',
429 default=3,
430 help="boto Http socket timeout"),
431 cfg.IntOpt('num_retries',
432 default=1,
433 help="boto num_retries on error"),
434 cfg.IntOpt('build_timeout',
435 default=60,
436 help="Status Change Timeout"),
437 cfg.IntOpt('build_interval',
438 default=1,
439 help="Status Change Test Interval"),
440]
Attila Fazekasf7f2d932012-12-13 09:14:38 +0100441
Attila Fazekasa23f5002012-10-23 19:32:45 +0200442
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500443def register_boto_opts(conf):
444 conf.register_group(boto_group)
445 for opt in BotoConfig:
446 conf.register_opt(opt, group='boto')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200447
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500448stress_group = cfg.OptGroup(name='stress', title='Stress Test Options')
449
450StressGroup = [
451 cfg.StrOpt('nova_logdir',
452 default=None,
453 help='Directory containing log files on the compute nodes'),
454 cfg.IntOpt('max_instances',
455 default=16,
456 help='Maximum number of instances to create during test.'),
457 cfg.StrOpt('controller',
458 default=None,
David Kranzb9d97502013-05-01 15:55:04 -0400459 help='Controller host.'),
460 # new stress options
461 cfg.StrOpt('target_controller',
462 default=None,
463 help='Controller host.'),
464 cfg.StrOpt('target_ssh_user',
465 default=None,
466 help='ssh user.'),
467 cfg.StrOpt('target_private_key_path',
468 default=None,
469 help='Path to private key.'),
470 cfg.StrOpt('target_logfiles',
471 default=None,
472 help='regexp for list of log files.'),
473 cfg.StrOpt('log_check_interval',
474 default=60,
475 help='time between log file error checks.')
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500476]
477
478
479def register_stress_opts(conf):
480 conf.register_group(stress_group)
481 for opt in StressGroup:
482 conf.register_opt(opt, group='stress')
483
Attila Fazekasa23f5002012-10-23 19:32:45 +0200484
Jay Pipes3f981df2012-03-27 18:59:44 -0400485@singleton
486class TempestConfig:
Daryl Walleck1465d612011-11-02 02:22:15 -0500487 """Provides OpenStack configuration information."""
488
Brian Waldon738cd632011-12-12 18:45:09 -0500489 DEFAULT_CONFIG_DIR = os.path.join(
Zhongyue Luoa1343de2013-01-04 16:21:35 +0800490 os.path.abspath(os.path.dirname(os.path.dirname(__file__))),
Brian Waldon738cd632011-12-12 18:45:09 -0500491 "etc")
Daryl Walleck1465d612011-11-02 02:22:15 -0500492
Brian Waldon738cd632011-12-12 18:45:09 -0500493 DEFAULT_CONFIG_FILE = "tempest.conf"
494
495 def __init__(self):
496 """Initialize a configuration from a conf directory and conf file."""
Sean Dague2416cf32013-04-10 08:29:07 -0400497 config_files = []
498
499 failsafe_path = "/etc/tempest/" + self.DEFAULT_CONFIG_FILE
Brian Waldon738cd632011-12-12 18:45:09 -0500500
501 # Environment variables override defaults...
502 conf_dir = os.environ.get('TEMPEST_CONFIG_DIR',
Zhongyue Luo79d8d362012-09-25 13:49:27 +0800503 self.DEFAULT_CONFIG_DIR)
504 conf_file = os.environ.get('TEMPEST_CONFIG', self.DEFAULT_CONFIG_FILE)
Brian Waldon738cd632011-12-12 18:45:09 -0500505
Jay Pipes7f757632011-12-02 15:53:32 -0500506 path = os.path.join(conf_dir, conf_file)
507
Zhongyue Luoafd43eb2013-02-04 11:32:57 +0800508 if not (os.path.isfile(path) or
509 'TEMPEST_CONFIG_DIR' in os.environ or
510 'TEMPEST_CONFIG' in os.environ):
Sean Dague2416cf32013-04-10 08:29:07 -0400511 path = failsafe_path
Attila Fazekas5abb2532012-12-04 11:30:49 +0100512
Jay Pipes3f981df2012-03-27 18:59:44 -0400513 LOG.info("Using tempest config file %s" % path)
514
Jay Pipes7f757632011-12-02 15:53:32 -0500515 if not os.path.exists(path):
516 msg = "Config file %(path)s not found" % locals()
Attila Fazekas5abb2532012-12-04 11:30:49 +0100517 print >> sys.stderr, RuntimeError(msg)
Sean Dague2416cf32013-04-10 08:29:07 -0400518 else:
519 config_files.append(path)
Jay Pipes7f757632011-12-02 15:53:32 -0500520
Sean Dague2416cf32013-04-10 08:29:07 -0400521 cfg.CONF([], project='tempest', default_config_files=config_files)
Daryl Walleck1465d612011-11-02 02:22:15 -0500522
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500523 register_compute_opts(cfg.CONF)
524 register_identity_opts(cfg.CONF)
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100525 register_whitebox_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500526 register_image_opts(cfg.CONF)
527 register_network_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500528 register_volume_opts(cfg.CONF)
529 register_object_storage_opts(cfg.CONF)
Steve Bakerc60e4e32013-05-06 15:22:41 +1200530 register_orchestration_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500531 register_boto_opts(cfg.CONF)
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100532 register_compute_admin_opts(cfg.CONF)
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500533 register_stress_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500534 self.compute = cfg.CONF.compute
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100535 self.whitebox = cfg.CONF.whitebox
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500536 self.identity = cfg.CONF.identity
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500537 self.images = cfg.CONF.image
538 self.network = cfg.CONF.network
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500539 self.volume = cfg.CONF.volume
540 self.object_storage = cfg.CONF['object-storage']
Steve Bakerc60e4e32013-05-06 15:22:41 +1200541 self.orchestration = cfg.CONF.orchestration
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500542 self.boto = cfg.CONF.boto
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100543 self.compute_admin = cfg.CONF['compute-admin']
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500544 self.stress = cfg.CONF.stress
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100545 if not self.compute_admin.username:
546 self.compute_admin.username = self.identity.admin_username
547 self.compute_admin.password = self.identity.admin_password
548 self.compute_admin.tenant_name = self.identity.admin_tenant_name