blob: f6fd1d908be58277f8b648b140ce2f9d0f277d2a [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
Dirk Muellere746fc22013-06-29 16:29:29 +020018from __future__ import print_function
19
Jay Pipes7f757632011-12-02 15:53:32 -050020import os
Attila Fazekas5abb2532012-12-04 11:30:49 +010021import sys
Jay Pipes3f981df2012-03-27 18:59:44 -040022
Dirk Muellere746fc22013-06-29 16:29:29 +020023
Matthew Treinish90aedd12013-02-25 17:56:49 -050024from oslo.config import cfg
25
Mitsuhiko Yamazaki46818aa2013-04-18 17:49:17 +090026from tempest.common import log as logging
Attila Fazekas3e1b6742013-01-28 16:30:35 +010027from tempest.common.utils.misc import singleton
Jay Pipes7f757632011-12-02 15:53:32 -050028
29LOG = logging.getLogger(__name__)
Daryl Walleck1465d612011-11-02 02:22:15 -050030
Matthew Treinish39e48ef2012-12-21 13:36:15 -050031identity_group = cfg.OptGroup(name='identity',
32 title="Keystone Configuration Options")
Daryl Walleck1465d612011-11-02 02:22:15 -050033
Matthew Treinish39e48ef2012-12-21 13:36:15 -050034IdentityGroup = [
35 cfg.StrOpt('catalog_type',
36 default='identity',
37 help="Catalog type of the Identity service."),
Jay Pipescd8eaec2013-01-16 21:03:48 -050038 cfg.BoolOpt('disable_ssl_certificate_validation',
39 default=False,
40 help="Set to True if using self-signed SSL certificates."),
Jay Pipes7c88eb22013-01-16 21:32:43 -050041 cfg.StrOpt('uri',
42 default=None,
Brant Knudsonc7ca3342013-03-28 21:08:50 -050043 help="Full URI of the OpenStack Identity API (Keystone), v2"),
44 cfg.StrOpt('uri_v3',
45 help='Full URI of the OpenStack Identity API (Keystone), v3'),
Matthew Treinish39e48ef2012-12-21 13:36:15 -050046 cfg.StrOpt('region',
Attila Fazekascadcb1f2013-01-21 23:10:53 +010047 default='RegionOne',
Matthew Treinish39e48ef2012-12-21 13:36:15 -050048 help="The identity region name to use."),
Attila Fazekascadcb1f2013-01-21 23:10:53 +010049 cfg.StrOpt('username',
50 default='demo',
51 help="Username to use for Nova API requests."),
52 cfg.StrOpt('tenant_name',
53 default='demo',
54 help="Tenant name to use for Nova API requests."),
55 cfg.StrOpt('password',
56 default='pass',
57 help="API key to use when authenticating.",
58 secret=True),
59 cfg.StrOpt('alt_username',
60 default=None,
61 help="Username of alternate user to use for Nova API "
62 "requests."),
63 cfg.StrOpt('alt_tenant_name',
64 default=None,
65 help="Alternate user's Tenant name to use for Nova API "
66 "requests."),
67 cfg.StrOpt('alt_password',
68 default=None,
69 help="API key to use when authenticating as alternate user.",
70 secret=True),
71 cfg.StrOpt('admin_username',
72 default='admin',
73 help="Administrative Username to use for"
74 "Keystone API requests."),
75 cfg.StrOpt('admin_tenant_name',
76 default='admin',
77 help="Administrative Tenant name to use for Keystone API "
78 "requests."),
79 cfg.StrOpt('admin_password',
80 default='pass',
81 help="API key to use when authenticating as admin.",
82 secret=True),
Matthew Treinish39e48ef2012-12-21 13:36:15 -050083]
Jay Pipes3f981df2012-03-27 18:59:44 -040084
Daryl Walleck1465d612011-11-02 02:22:15 -050085
Matthew Treinish39e48ef2012-12-21 13:36:15 -050086def register_identity_opts(conf):
87 conf.register_group(identity_group)
88 for opt in IdentityGroup:
89 conf.register_opt(opt, group='identity')
Daryl Walleck1465d612011-11-02 02:22:15 -050090
Jay Pipes3f981df2012-03-27 18:59:44 -040091
Matthew Treinish39e48ef2012-12-21 13:36:15 -050092compute_group = cfg.OptGroup(name='compute',
93 title='Compute Service Options')
Rohit Karajgie1b050d2011-12-02 16:13:18 -080094
Matthew Treinish39e48ef2012-12-21 13:36:15 -050095ComputeGroup = [
96 cfg.BoolOpt('allow_tenant_isolation',
97 default=False,
98 help="Allows test cases to create/destroy tenants and "
99 "users. This option enables isolated test cases and "
100 "better parallel execution, but also requires that "
101 "OpenStack Identity API admin credentials are known."),
102 cfg.BoolOpt('allow_tenant_reuse',
103 default=True,
104 help="If allow_tenant_isolation is True and a tenant that "
105 "would be created for a given test already exists (such "
106 "as from a previously-failed run), re-use that tenant "
107 "instead of failing because of the conflict. Note that "
108 "this would result in the tenant being deleted at the "
109 "end of a subsequent successful run."),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500110 cfg.StrOpt('image_ref',
111 default="{$IMAGE_ID}",
112 help="Valid secondary image reference to be used in tests."),
113 cfg.StrOpt('image_ref_alt',
114 default="{$IMAGE_ID_ALT}",
115 help="Valid secondary image reference to be used in tests."),
116 cfg.IntOpt('flavor_ref',
117 default=1,
118 help="Valid primary flavor to use in tests."),
119 cfg.IntOpt('flavor_ref_alt',
120 default=2,
121 help='Valid secondary flavor to be used in tests.'),
Maru Newbyaf292e82013-05-20 21:32:28 +0000122 cfg.StrOpt('image_ssh_user',
123 default="root",
124 help="User name used to authenticate to an instance."),
125 cfg.StrOpt('image_alt_ssh_user',
126 default="root",
127 help="User name used to authenticate to an instance using "
128 "the alternate image."),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500129 cfg.BoolOpt('resize_available',
130 default=False,
131 help="Does the test environment support resizing?"),
132 cfg.BoolOpt('live_migration_available',
133 default=False,
134 help="Does the test environment support live migration "
135 "available?"),
136 cfg.BoolOpt('use_block_migration_for_live_migration',
137 default=False,
138 help="Does the test environment use block devices for live "
139 "migration"),
Bob Ballc078be92013-04-09 14:25:00 +0100140 cfg.BoolOpt('block_migrate_supports_cinder_iscsi',
141 default=False,
142 help="Does the test environment block migration support "
143 "cinder iSCSI volumes"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500144 cfg.BoolOpt('change_password_available',
145 default=False,
146 help="Does the test environment support changing the admin "
147 "password?"),
148 cfg.BoolOpt('create_image_enabled',
149 default=False,
150 help="Does the test environment support snapshots?"),
151 cfg.IntOpt('build_interval',
152 default=10,
153 help="Time in seconds between build status checks."),
154 cfg.IntOpt('build_timeout',
155 default=300,
156 help="Timeout in seconds to wait for an instance to build."),
157 cfg.BoolOpt('run_ssh',
158 default=False,
159 help="Does the test environment support snapshots?"),
160 cfg.StrOpt('ssh_user',
161 default='root',
162 help="User name used to authenticate to an instance."),
163 cfg.IntOpt('ssh_timeout',
164 default=300,
Chris Yeoh76916042013-02-27 16:25:25 +1030165 help="Timeout in seconds to wait for authentication to "
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500166 "succeed."),
Chris Yeoh76916042013-02-27 16:25:25 +1030167 cfg.IntOpt('ssh_channel_timeout',
168 default=60,
169 help="Timeout in seconds to wait for output from ssh "
170 "channel."),
Attila Fazekasb0661652013-05-08 13:01:36 +0200171 cfg.StrOpt('fixed_network_name',
172 default='private',
173 help="Visible fixed network name "),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500174 cfg.StrOpt('network_for_ssh',
175 default='public',
176 help="Network used for SSH connections."),
177 cfg.IntOpt('ip_version_for_ssh',
178 default=4,
179 help="IP version used for SSH connections."),
180 cfg.StrOpt('catalog_type',
181 default='compute',
182 help="Catalog type of the Compute service."),
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100183 cfg.StrOpt('path_to_private_key',
184 default=None,
185 help="Path to a private key file for SSH access to remote "
186 "hosts"),
Attila Fazekas86950732013-06-08 09:33:08 +0200187 cfg.BoolOpt('disk_config_enabled',
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100188 default=True,
Attila Fazekas86950732013-06-08 09:33:08 +0200189 help="If false, skip disk config tests"),
190 cfg.BoolOpt('flavor_extra_enabled',
191 default=True,
192 help="If false, skip flavor extra data test"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500193]
Rohit Karajgie1b050d2011-12-02 16:13:18 -0800194
Rohit Karajgie1b050d2011-12-02 16:13:18 -0800195
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500196def register_compute_opts(conf):
197 conf.register_group(compute_group)
198 for opt in ComputeGroup:
199 conf.register_opt(opt, group='compute')
kavan-patil4ea2efb2011-12-09 08:58:50 +0000200
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500201compute_admin_group = cfg.OptGroup(name='compute-admin',
202 title="Compute Admin Options")
donald-ngo7fb1efa2011-12-13 17:17:36 -0800203
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500204ComputeAdminGroup = [
205 cfg.StrOpt('username',
206 default='admin',
207 help="Administrative Username to use for Nova API requests."),
208 cfg.StrOpt('tenant_name',
209 default='admin',
210 help="Administrative Tenant name to use for Nova API "
211 "requests."),
212 cfg.StrOpt('password',
213 default='pass',
214 help="API key to use when authenticating as admin.",
215 secret=True),
216]
Daryl Walleck587385b2012-03-03 13:00:26 -0600217
K Jonathan Harkerd6ba4b42012-12-18 13:50:47 -0800218
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500219def register_compute_admin_opts(conf):
220 conf.register_group(compute_admin_group)
221 for opt in ComputeAdminGroup:
222 conf.register_opt(opt, group='compute-admin')
Daryl Walleck587385b2012-03-03 13:00:26 -0600223
Jay Pipesf38eaac2012-06-21 13:37:35 -0400224
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100225whitebox_group = cfg.OptGroup(name='whitebox',
226 title="Whitebox Options")
227
228WhiteboxGroup = [
229 cfg.BoolOpt('whitebox_enabled',
230 default=False,
231 help="Does the test environment support whitebox tests for "
232 "Compute?"),
233 cfg.StrOpt('db_uri',
234 default=None,
235 help="Connection string to the database of Compute service"),
236 cfg.StrOpt('source_dir',
237 default="/opt/stack/nova",
238 help="Path of nova source directory"),
239 cfg.StrOpt('config_path',
240 default='/etc/nova/nova.conf',
241 help="Path of nova configuration file"),
242 cfg.StrOpt('bin_dir',
243 default="/usr/local/bin/",
244 help="Directory containing nova binaries such as nova-manage"),
245]
246
247
248def register_whitebox_opts(conf):
249 conf.register_group(whitebox_group)
250 for opt in WhiteboxGroup:
251 conf.register_opt(opt, group='whitebox')
252
253
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500254image_group = cfg.OptGroup(name='image',
255 title="Image Service Options")
Jay Pipesf38eaac2012-06-21 13:37:35 -0400256
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500257ImageGroup = [
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500258 cfg.StrOpt('api_version',
259 default='1',
260 help="Version of the API"),
Matthew Treinish72ea4422013-02-07 14:42:49 -0500261 cfg.StrOpt('catalog_type',
262 default='image',
Sean Dague83401992013-05-06 17:46:36 -0400263 help='Catalog type of the Image service.'),
264 cfg.StrOpt('http_image',
265 default='http://download.cirros-cloud.net/0.3.1/'
266 'cirros-0.3.1-x86_64-uec.tar.gz',
267 help='http accessable image')
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500268]
Jay Pipesf38eaac2012-06-21 13:37:35 -0400269
Jay Pipesf38eaac2012-06-21 13:37:35 -0400270
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500271def register_image_opts(conf):
272 conf.register_group(image_group)
273 for opt in ImageGroup:
274 conf.register_opt(opt, group='image')
Jay Pipesf38eaac2012-06-21 13:37:35 -0400275
276
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500277network_group = cfg.OptGroup(name='network',
278 title='Network Service Options')
Daryl Walleck587385b2012-03-03 13:00:26 -0600279
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500280NetworkGroup = [
281 cfg.StrOpt('catalog_type',
282 default='network',
283 help='Catalog type of the Quantum service.'),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500284 cfg.StrOpt('tenant_network_cidr',
285 default="10.100.0.0/16",
286 help="The cidr block to allocate tenant networks from"),
287 cfg.IntOpt('tenant_network_mask_bits',
288 default=29,
289 help="The mask bits for tenant networks"),
290 cfg.BoolOpt('tenant_networks_reachable',
291 default=False,
292 help="Whether tenant network connectivity should be "
293 "evaluated directly"),
294 cfg.StrOpt('public_network_id',
295 default="",
296 help="Id of the public network that provides external "
297 "connectivity"),
298 cfg.StrOpt('public_router_id',
299 default="",
300 help="Id of the public router that provides external "
301 "connectivity"),
Dan Smithd6c1f882013-02-26 15:50:11 -0500302 cfg.BoolOpt('quantum_available',
303 default=False,
304 help="Whether or not quantum is expected to be available"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500305]
Jay Pipes3f981df2012-03-27 18:59:44 -0400306
Jay Pipesf38eaac2012-06-21 13:37:35 -0400307
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500308def register_network_opts(conf):
309 conf.register_group(network_group)
310 for opt in NetworkGroup:
311 conf.register_opt(opt, group='network')
Dan Smithd6ff6b72012-08-23 10:29:41 -0700312
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500313volume_group = cfg.OptGroup(name='volume',
314 title='Block Storage Options')
Daryl Walleck587385b2012-03-03 13:00:26 -0600315
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500316VolumeGroup = [
317 cfg.IntOpt('build_interval',
318 default=10,
319 help='Time in seconds between volume availability checks.'),
320 cfg.IntOpt('build_timeout',
321 default=300,
322 help='Timeout in seconds to wait for a volume to become'
323 'available.'),
324 cfg.StrOpt('catalog_type',
325 default='Volume',
326 help="Catalog type of the Volume Service"),
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100327 cfg.BoolOpt('multi_backend_enabled',
328 default=False,
Giulio Fidentef4fa8942013-05-28 18:48:03 +0200329 help="Runs Cinder multi-backend test (requires 2 backends)"),
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100330 cfg.StrOpt('backend1_name',
Giulio Fidentef4fa8942013-05-28 18:48:03 +0200331 default='BACKEND_1',
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100332 help="Name of the backend1 (must be declared in cinder.conf)"),
333 cfg.StrOpt('backend2_name',
Giulio Fidentef4fa8942013-05-28 18:48:03 +0200334 default='BACKEND_2',
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100335 help="Name of the backend2 (must be declared in cinder.conf)"),
Adam Gandelman827ad332013-06-24 17:04:09 -0700336 cfg.StrOpt('storage_protocol',
337 default='iSCSI',
338 help='Backend protocol to target when creating volume types'),
339 cfg.StrOpt('vendor_name',
340 default='Open Source',
341 help='Backend vendor to target when creating volume types'),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500342]
K Jonathan Harkerd6ba4b42012-12-18 13:50:47 -0800343
Daryl Walleck587385b2012-03-03 13:00:26 -0600344
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500345def register_volume_opts(conf):
346 conf.register_group(volume_group)
347 for opt in VolumeGroup:
348 conf.register_opt(opt, group='volume')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200349
Attila Fazekasa23f5002012-10-23 19:32:45 +0200350
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500351object_storage_group = cfg.OptGroup(name='object-storage',
352 title='Object Storage Service Options')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200353
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500354ObjectStoreConfig = [
355 cfg.StrOpt('catalog_type',
356 default='object-store',
357 help="Catalog type of the Object-Storage service."),
nayna-patelb4989b32013-01-09 06:25:13 +0000358 cfg.StrOpt('container_sync_timeout',
359 default=120,
360 help="Number of seconds to time on waiting for a container"
361 "to container synchronization complete."),
362 cfg.StrOpt('container_sync_interval',
363 default=5,
364 help="Number of seconds to wait while looping to check the"
365 "status of a container to container synchronization"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500366]
Attila Fazekasa23f5002012-10-23 19:32:45 +0200367
Attila Fazekasa23f5002012-10-23 19:32:45 +0200368
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500369def register_object_storage_opts(conf):
370 conf.register_group(object_storage_group)
371 for opt in ObjectStoreConfig:
372 conf.register_opt(opt, group='object-storage')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200373
Steve Bakerc60e4e32013-05-06 15:22:41 +1200374
375orchestration_group = cfg.OptGroup(name='orchestration',
376 title='Orchestration Service Options')
377
378OrchestrationGroup = [
379 cfg.StrOpt('catalog_type',
380 default='orchestration',
381 help="Catalog type of the Orchestration service."),
382 cfg.BoolOpt('allow_tenant_isolation',
383 default=False,
384 help="Allows test cases to create/destroy tenants and "
385 "users. This option enables isolated test cases and "
386 "better parallel execution, but also requires that "
387 "OpenStack Identity API admin credentials are known."),
388 cfg.IntOpt('build_interval',
389 default=1,
390 help="Time in seconds between build status checks."),
391 cfg.IntOpt('build_timeout',
392 default=300,
393 help="Timeout in seconds to wait for a stack to build."),
394 cfg.BoolOpt('heat_available',
395 default=False,
396 help="Whether or not Heat is expected to be available"),
397 cfg.StrOpt('instance_type',
Steve Baker9e86b832013-05-22 15:40:28 +1200398 default='m1.micro',
Steve Bakerc60e4e32013-05-06 15:22:41 +1200399 help="Instance type for tests. Needs to be big enough for a "
400 "full OS plus the test workload"),
401 cfg.StrOpt('image_ref',
402 default=None,
403 help="Name of heat-cfntools enabled image to use when "
404 "launching test instances."),
405 cfg.StrOpt('keypair_name',
406 default=None,
407 help="Name of existing keypair to launch servers with."),
408]
409
410
411def register_orchestration_opts(conf):
412 conf.register_group(orchestration_group)
413 for opt in OrchestrationGroup:
414 conf.register_opt(opt, group='orchestration')
415
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500416boto_group = cfg.OptGroup(name='boto',
417 title='EC2/S3 options')
418BotoConfig = [
419 cfg.StrOpt('ec2_url',
420 default="http://localhost:8773/services/Cloud",
421 help="EC2 URL"),
422 cfg.StrOpt('s3_url',
423 default="http://localhost:8080",
424 help="S3 URL"),
425 cfg.StrOpt('aws_secret',
426 default=None,
427 help="AWS Secret Key",
428 secret=True),
429 cfg.StrOpt('aws_access',
430 default=None,
431 help="AWS Access Key"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500432 cfg.StrOpt('s3_materials_path',
433 default="/opt/stack/devstack/files/images/"
434 "s3-materials/cirros-0.3.0",
435 help="S3 Materials Path"),
436 cfg.StrOpt('ari_manifest',
437 default="cirros-0.3.0-x86_64-initrd.manifest.xml",
438 help="ARI Ramdisk Image manifest"),
439 cfg.StrOpt('ami_manifest',
440 default="cirros-0.3.0-x86_64-blank.img.manifest.xml",
441 help="AMI Machine Image manifest"),
442 cfg.StrOpt('aki_manifest',
443 default="cirros-0.3.0-x86_64-vmlinuz.manifest.xml",
444 help="AKI Kernel Image manifest"),
445 cfg.StrOpt('instance_type',
446 default="m1.tiny",
447 help="Instance type"),
448 cfg.IntOpt('http_socket_timeout',
449 default=3,
450 help="boto Http socket timeout"),
451 cfg.IntOpt('num_retries',
452 default=1,
453 help="boto num_retries on error"),
454 cfg.IntOpt('build_timeout',
455 default=60,
456 help="Status Change Timeout"),
457 cfg.IntOpt('build_interval',
458 default=1,
459 help="Status Change Test Interval"),
460]
Attila Fazekasf7f2d932012-12-13 09:14:38 +0100461
Attila Fazekasa23f5002012-10-23 19:32:45 +0200462
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500463def register_boto_opts(conf):
464 conf.register_group(boto_group)
465 for opt in BotoConfig:
466 conf.register_opt(opt, group='boto')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200467
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500468stress_group = cfg.OptGroup(name='stress', title='Stress Test Options')
469
470StressGroup = [
471 cfg.StrOpt('nova_logdir',
472 default=None,
473 help='Directory containing log files on the compute nodes'),
474 cfg.IntOpt('max_instances',
475 default=16,
476 help='Maximum number of instances to create during test.'),
477 cfg.StrOpt('controller',
478 default=None,
David Kranzb9d97502013-05-01 15:55:04 -0400479 help='Controller host.'),
480 # new stress options
481 cfg.StrOpt('target_controller',
482 default=None,
483 help='Controller host.'),
484 cfg.StrOpt('target_ssh_user',
485 default=None,
486 help='ssh user.'),
487 cfg.StrOpt('target_private_key_path',
488 default=None,
489 help='Path to private key.'),
490 cfg.StrOpt('target_logfiles',
491 default=None,
492 help='regexp for list of log files.'),
493 cfg.StrOpt('log_check_interval',
494 default=60,
495 help='time between log file error checks.')
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500496]
497
498
499def register_stress_opts(conf):
500 conf.register_group(stress_group)
501 for opt in StressGroup:
502 conf.register_opt(opt, group='stress')
503
Attila Fazekasa23f5002012-10-23 19:32:45 +0200504
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900505scenario_group = cfg.OptGroup(name='scenario', title='Scenario Test Options')
506
507ScenarioGroup = [
508 cfg.StrOpt('img_dir',
509 default='/opt/stack/new/devstack/files/images/'
510 'cirros-0.3.1-x86_64-uec',
511 help='Directory containing image files'),
512 cfg.StrOpt('ami_img_file',
513 default='cirros-0.3.1-x86_64-blank.img',
514 help='AMI image file name'),
515 cfg.StrOpt('ari_img_file',
516 default='cirros-0.3.1-x86_64-initrd',
517 help='ARI image file name'),
518 cfg.StrOpt('aki_img_file',
519 default='cirros-0.3.1-x86_64-vmlinuz',
520 help='AKI image file name'),
521 cfg.StrOpt('ssh_user',
522 default='cirros',
523 help='ssh username for the image file')
524]
525
526
527def register_scenario_opts(conf):
528 conf.register_group(scenario_group)
529 for opt in ScenarioGroup:
530 conf.register_opt(opt, group='scenario')
531
532
Jay Pipes3f981df2012-03-27 18:59:44 -0400533@singleton
534class TempestConfig:
Daryl Walleck1465d612011-11-02 02:22:15 -0500535 """Provides OpenStack configuration information."""
536
Brian Waldon738cd632011-12-12 18:45:09 -0500537 DEFAULT_CONFIG_DIR = os.path.join(
Zhongyue Luoa1343de2013-01-04 16:21:35 +0800538 os.path.abspath(os.path.dirname(os.path.dirname(__file__))),
Brian Waldon738cd632011-12-12 18:45:09 -0500539 "etc")
Daryl Walleck1465d612011-11-02 02:22:15 -0500540
Brian Waldon738cd632011-12-12 18:45:09 -0500541 DEFAULT_CONFIG_FILE = "tempest.conf"
542
543 def __init__(self):
544 """Initialize a configuration from a conf directory and conf file."""
Sean Dague2416cf32013-04-10 08:29:07 -0400545 config_files = []
546
547 failsafe_path = "/etc/tempest/" + self.DEFAULT_CONFIG_FILE
Brian Waldon738cd632011-12-12 18:45:09 -0500548
549 # Environment variables override defaults...
550 conf_dir = os.environ.get('TEMPEST_CONFIG_DIR',
Zhongyue Luo79d8d362012-09-25 13:49:27 +0800551 self.DEFAULT_CONFIG_DIR)
552 conf_file = os.environ.get('TEMPEST_CONFIG', self.DEFAULT_CONFIG_FILE)
Brian Waldon738cd632011-12-12 18:45:09 -0500553
Jay Pipes7f757632011-12-02 15:53:32 -0500554 path = os.path.join(conf_dir, conf_file)
555
Zhongyue Luoafd43eb2013-02-04 11:32:57 +0800556 if not (os.path.isfile(path) or
557 'TEMPEST_CONFIG_DIR' in os.environ or
558 'TEMPEST_CONFIG' in os.environ):
Sean Dague2416cf32013-04-10 08:29:07 -0400559 path = failsafe_path
Attila Fazekas5abb2532012-12-04 11:30:49 +0100560
Jay Pipes3f981df2012-03-27 18:59:44 -0400561 LOG.info("Using tempest config file %s" % path)
562
Jay Pipes7f757632011-12-02 15:53:32 -0500563 if not os.path.exists(path):
564 msg = "Config file %(path)s not found" % locals()
Dirk Muellere746fc22013-06-29 16:29:29 +0200565 print(RuntimeError(msg), file=sys.stderr)
Sean Dague2416cf32013-04-10 08:29:07 -0400566 else:
567 config_files.append(path)
Jay Pipes7f757632011-12-02 15:53:32 -0500568
Sean Dague2416cf32013-04-10 08:29:07 -0400569 cfg.CONF([], project='tempest', default_config_files=config_files)
Daryl Walleck1465d612011-11-02 02:22:15 -0500570
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500571 register_compute_opts(cfg.CONF)
572 register_identity_opts(cfg.CONF)
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100573 register_whitebox_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500574 register_image_opts(cfg.CONF)
575 register_network_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500576 register_volume_opts(cfg.CONF)
577 register_object_storage_opts(cfg.CONF)
Steve Bakerc60e4e32013-05-06 15:22:41 +1200578 register_orchestration_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500579 register_boto_opts(cfg.CONF)
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100580 register_compute_admin_opts(cfg.CONF)
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500581 register_stress_opts(cfg.CONF)
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900582 register_scenario_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500583 self.compute = cfg.CONF.compute
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100584 self.whitebox = cfg.CONF.whitebox
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500585 self.identity = cfg.CONF.identity
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500586 self.images = cfg.CONF.image
587 self.network = cfg.CONF.network
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500588 self.volume = cfg.CONF.volume
589 self.object_storage = cfg.CONF['object-storage']
Steve Bakerc60e4e32013-05-06 15:22:41 +1200590 self.orchestration = cfg.CONF.orchestration
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500591 self.boto = cfg.CONF.boto
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100592 self.compute_admin = cfg.CONF['compute-admin']
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500593 self.stress = cfg.CONF.stress
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900594 self.scenario = cfg.CONF.scenario
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100595 if not self.compute_admin.username:
596 self.compute_admin.username = self.identity.admin_username
597 self.compute_admin.password = self.identity.admin_password
598 self.compute_admin.tenant_name = self.identity.admin_tenant_name