blob: 71960788587b7762ce16763bcde7b8fa761de644 [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 os
Attila Fazekas5abb2532012-12-04 11:30:49 +010019import sys
Jay Pipes3f981df2012-03-27 18:59:44 -040020
Matthew Treinish90aedd12013-02-25 17:56:49 -050021from oslo.config import cfg
22
Mitsuhiko Yamazaki46818aa2013-04-18 17:49:17 +090023from tempest.common import log as logging
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,
Brant Knudsonc7ca3342013-03-28 21:08:50 -050040 help="Full URI of the OpenStack Identity API (Keystone), v2"),
41 cfg.StrOpt('uri_v3',
42 help='Full URI of the OpenStack Identity API (Keystone), v3'),
Matthew Treinish39e48ef2012-12-21 13:36:15 -050043 cfg.StrOpt('region',
Attila Fazekascadcb1f2013-01-21 23:10:53 +010044 default='RegionOne',
Matthew Treinish39e48ef2012-12-21 13:36:15 -050045 help="The identity region name to use."),
Attila Fazekascadcb1f2013-01-21 23:10:53 +010046 cfg.StrOpt('username',
47 default='demo',
48 help="Username to use for Nova API requests."),
49 cfg.StrOpt('tenant_name',
50 default='demo',
51 help="Tenant name to use for Nova API requests."),
52 cfg.StrOpt('password',
53 default='pass',
54 help="API key to use when authenticating.",
55 secret=True),
56 cfg.StrOpt('alt_username',
57 default=None,
58 help="Username of alternate user to use for Nova API "
59 "requests."),
60 cfg.StrOpt('alt_tenant_name',
61 default=None,
62 help="Alternate user's Tenant name to use for Nova API "
63 "requests."),
64 cfg.StrOpt('alt_password',
65 default=None,
66 help="API key to use when authenticating as alternate user.",
67 secret=True),
68 cfg.StrOpt('admin_username',
69 default='admin',
70 help="Administrative Username to use for"
71 "Keystone API requests."),
72 cfg.StrOpt('admin_tenant_name',
73 default='admin',
74 help="Administrative Tenant name to use for Keystone API "
75 "requests."),
76 cfg.StrOpt('admin_password',
77 default='pass',
78 help="API key to use when authenticating as admin.",
79 secret=True),
Matthew Treinish39e48ef2012-12-21 13:36:15 -050080]
Jay Pipes3f981df2012-03-27 18:59:44 -040081
Daryl Walleck1465d612011-11-02 02:22:15 -050082
Matthew Treinish39e48ef2012-12-21 13:36:15 -050083def register_identity_opts(conf):
84 conf.register_group(identity_group)
85 for opt in IdentityGroup:
86 conf.register_opt(opt, group='identity')
Daryl Walleck1465d612011-11-02 02:22:15 -050087
Jay Pipes3f981df2012-03-27 18:59:44 -040088
Matthew Treinish39e48ef2012-12-21 13:36:15 -050089compute_group = cfg.OptGroup(name='compute',
90 title='Compute Service Options')
Rohit Karajgie1b050d2011-12-02 16:13:18 -080091
Matthew Treinish39e48ef2012-12-21 13:36:15 -050092ComputeGroup = [
93 cfg.BoolOpt('allow_tenant_isolation',
94 default=False,
95 help="Allows test cases to create/destroy tenants and "
96 "users. This option enables isolated test cases and "
97 "better parallel execution, but also requires that "
98 "OpenStack Identity API admin credentials are known."),
99 cfg.BoolOpt('allow_tenant_reuse',
100 default=True,
101 help="If allow_tenant_isolation is True and a tenant that "
102 "would be created for a given test already exists (such "
103 "as from a previously-failed run), re-use that tenant "
104 "instead of failing because of the conflict. Note that "
105 "this would result in the tenant being deleted at the "
106 "end of a subsequent successful run."),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500107 cfg.StrOpt('image_ref',
108 default="{$IMAGE_ID}",
109 help="Valid secondary image reference to be used in tests."),
110 cfg.StrOpt('image_ref_alt',
111 default="{$IMAGE_ID_ALT}",
112 help="Valid secondary image reference to be used in tests."),
113 cfg.IntOpt('flavor_ref',
114 default=1,
115 help="Valid primary flavor to use in tests."),
116 cfg.IntOpt('flavor_ref_alt',
117 default=2,
118 help='Valid secondary flavor to be used in tests.'),
Maru Newbyaf292e82013-05-20 21:32:28 +0000119 cfg.StrOpt('image_ssh_user',
120 default="root",
121 help="User name used to authenticate to an instance."),
122 cfg.StrOpt('image_alt_ssh_user',
123 default="root",
124 help="User name used to authenticate to an instance using "
125 "the alternate image."),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500126 cfg.BoolOpt('resize_available',
127 default=False,
128 help="Does the test environment support resizing?"),
129 cfg.BoolOpt('live_migration_available',
130 default=False,
131 help="Does the test environment support live migration "
132 "available?"),
133 cfg.BoolOpt('use_block_migration_for_live_migration',
134 default=False,
135 help="Does the test environment use block devices for live "
136 "migration"),
Bob Ballc078be92013-04-09 14:25:00 +0100137 cfg.BoolOpt('block_migrate_supports_cinder_iscsi',
138 default=False,
139 help="Does the test environment block migration support "
140 "cinder iSCSI volumes"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500141 cfg.BoolOpt('change_password_available',
142 default=False,
143 help="Does the test environment support changing the admin "
144 "password?"),
145 cfg.BoolOpt('create_image_enabled',
146 default=False,
147 help="Does the test environment support snapshots?"),
148 cfg.IntOpt('build_interval',
149 default=10,
150 help="Time in seconds between build status checks."),
151 cfg.IntOpt('build_timeout',
152 default=300,
153 help="Timeout in seconds to wait for an instance to build."),
154 cfg.BoolOpt('run_ssh',
155 default=False,
156 help="Does the test environment support snapshots?"),
157 cfg.StrOpt('ssh_user',
158 default='root',
159 help="User name used to authenticate to an instance."),
160 cfg.IntOpt('ssh_timeout',
161 default=300,
Chris Yeoh76916042013-02-27 16:25:25 +1030162 help="Timeout in seconds to wait for authentication to "
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500163 "succeed."),
Chris Yeoh76916042013-02-27 16:25:25 +1030164 cfg.IntOpt('ssh_channel_timeout',
165 default=60,
166 help="Timeout in seconds to wait for output from ssh "
167 "channel."),
Attila Fazekasb0661652013-05-08 13:01:36 +0200168 cfg.StrOpt('fixed_network_name',
169 default='private',
170 help="Visible fixed network name "),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500171 cfg.StrOpt('network_for_ssh',
172 default='public',
173 help="Network used for SSH connections."),
174 cfg.IntOpt('ip_version_for_ssh',
175 default=4,
176 help="IP version used for SSH connections."),
177 cfg.StrOpt('catalog_type',
178 default='compute',
179 help="Catalog type of the Compute service."),
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100180 cfg.StrOpt('path_to_private_key',
181 default=None,
182 help="Path to a private key file for SSH access to remote "
183 "hosts"),
Attila Fazekas86950732013-06-08 09:33:08 +0200184 cfg.BoolOpt('disk_config_enabled',
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100185 default=True,
Attila Fazekas86950732013-06-08 09:33:08 +0200186 help="If false, skip disk config tests"),
187 cfg.BoolOpt('flavor_extra_enabled',
188 default=True,
189 help="If false, skip flavor extra data test"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500190]
Rohit Karajgie1b050d2011-12-02 16:13:18 -0800191
Rohit Karajgie1b050d2011-12-02 16:13:18 -0800192
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500193def register_compute_opts(conf):
194 conf.register_group(compute_group)
195 for opt in ComputeGroup:
196 conf.register_opt(opt, group='compute')
kavan-patil4ea2efb2011-12-09 08:58:50 +0000197
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500198compute_admin_group = cfg.OptGroup(name='compute-admin',
199 title="Compute Admin Options")
donald-ngo7fb1efa2011-12-13 17:17:36 -0800200
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500201ComputeAdminGroup = [
202 cfg.StrOpt('username',
203 default='admin',
204 help="Administrative Username to use for Nova API requests."),
205 cfg.StrOpt('tenant_name',
206 default='admin',
207 help="Administrative Tenant name to use for Nova API "
208 "requests."),
209 cfg.StrOpt('password',
210 default='pass',
211 help="API key to use when authenticating as admin.",
212 secret=True),
213]
Daryl Walleck587385b2012-03-03 13:00:26 -0600214
K Jonathan Harkerd6ba4b42012-12-18 13:50:47 -0800215
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500216def register_compute_admin_opts(conf):
217 conf.register_group(compute_admin_group)
218 for opt in ComputeAdminGroup:
219 conf.register_opt(opt, group='compute-admin')
Daryl Walleck587385b2012-03-03 13:00:26 -0600220
Jay Pipesf38eaac2012-06-21 13:37:35 -0400221
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100222whitebox_group = cfg.OptGroup(name='whitebox',
223 title="Whitebox Options")
224
225WhiteboxGroup = [
226 cfg.BoolOpt('whitebox_enabled',
227 default=False,
228 help="Does the test environment support whitebox tests for "
229 "Compute?"),
230 cfg.StrOpt('db_uri',
231 default=None,
232 help="Connection string to the database of Compute service"),
233 cfg.StrOpt('source_dir',
234 default="/opt/stack/nova",
235 help="Path of nova source directory"),
236 cfg.StrOpt('config_path',
237 default='/etc/nova/nova.conf',
238 help="Path of nova configuration file"),
239 cfg.StrOpt('bin_dir',
240 default="/usr/local/bin/",
241 help="Directory containing nova binaries such as nova-manage"),
242]
243
244
245def register_whitebox_opts(conf):
246 conf.register_group(whitebox_group)
247 for opt in WhiteboxGroup:
248 conf.register_opt(opt, group='whitebox')
249
250
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500251image_group = cfg.OptGroup(name='image',
252 title="Image Service Options")
Jay Pipesf38eaac2012-06-21 13:37:35 -0400253
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500254ImageGroup = [
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500255 cfg.StrOpt('api_version',
256 default='1',
257 help="Version of the API"),
Matthew Treinish72ea4422013-02-07 14:42:49 -0500258 cfg.StrOpt('catalog_type',
259 default='image',
Sean Dague83401992013-05-06 17:46:36 -0400260 help='Catalog type of the Image service.'),
261 cfg.StrOpt('http_image',
262 default='http://download.cirros-cloud.net/0.3.1/'
263 'cirros-0.3.1-x86_64-uec.tar.gz',
264 help='http accessable image')
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500265]
Jay Pipesf38eaac2012-06-21 13:37:35 -0400266
Jay Pipesf38eaac2012-06-21 13:37:35 -0400267
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500268def register_image_opts(conf):
269 conf.register_group(image_group)
270 for opt in ImageGroup:
271 conf.register_opt(opt, group='image')
Jay Pipesf38eaac2012-06-21 13:37:35 -0400272
273
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500274network_group = cfg.OptGroup(name='network',
275 title='Network Service Options')
Daryl Walleck587385b2012-03-03 13:00:26 -0600276
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500277NetworkGroup = [
278 cfg.StrOpt('catalog_type',
279 default='network',
280 help='Catalog type of the Quantum service.'),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500281 cfg.StrOpt('tenant_network_cidr',
282 default="10.100.0.0/16",
283 help="The cidr block to allocate tenant networks from"),
284 cfg.IntOpt('tenant_network_mask_bits',
285 default=29,
286 help="The mask bits for tenant networks"),
287 cfg.BoolOpt('tenant_networks_reachable',
288 default=False,
289 help="Whether tenant network connectivity should be "
290 "evaluated directly"),
291 cfg.StrOpt('public_network_id',
292 default="",
293 help="Id of the public network that provides external "
294 "connectivity"),
295 cfg.StrOpt('public_router_id',
296 default="",
297 help="Id of the public router that provides external "
298 "connectivity"),
Dan Smithd6c1f882013-02-26 15:50:11 -0500299 cfg.BoolOpt('quantum_available',
300 default=False,
301 help="Whether or not quantum is expected to be available"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500302]
Jay Pipes3f981df2012-03-27 18:59:44 -0400303
Jay Pipesf38eaac2012-06-21 13:37:35 -0400304
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500305def register_network_opts(conf):
306 conf.register_group(network_group)
307 for opt in NetworkGroup:
308 conf.register_opt(opt, group='network')
Dan Smithd6ff6b72012-08-23 10:29:41 -0700309
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500310volume_group = cfg.OptGroup(name='volume',
311 title='Block Storage Options')
Daryl Walleck587385b2012-03-03 13:00:26 -0600312
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500313VolumeGroup = [
314 cfg.IntOpt('build_interval',
315 default=10,
316 help='Time in seconds between volume availability checks.'),
317 cfg.IntOpt('build_timeout',
318 default=300,
319 help='Timeout in seconds to wait for a volume to become'
320 'available.'),
321 cfg.StrOpt('catalog_type',
322 default='Volume',
323 help="Catalog type of the Volume Service"),
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100324 cfg.BoolOpt('multi_backend_enabled',
325 default=False,
Giulio Fidentef4fa8942013-05-28 18:48:03 +0200326 help="Runs Cinder multi-backend test (requires 2 backends)"),
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100327 cfg.StrOpt('backend1_name',
Giulio Fidentef4fa8942013-05-28 18:48:03 +0200328 default='BACKEND_1',
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100329 help="Name of the backend1 (must be declared in cinder.conf)"),
330 cfg.StrOpt('backend2_name',
Giulio Fidentef4fa8942013-05-28 18:48:03 +0200331 default='BACKEND_2',
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100332 help="Name of the backend2 (must be declared in cinder.conf)"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500333]
K Jonathan Harkerd6ba4b42012-12-18 13:50:47 -0800334
Daryl Walleck587385b2012-03-03 13:00:26 -0600335
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500336def register_volume_opts(conf):
337 conf.register_group(volume_group)
338 for opt in VolumeGroup:
339 conf.register_opt(opt, group='volume')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200340
Attila Fazekasa23f5002012-10-23 19:32:45 +0200341
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500342object_storage_group = cfg.OptGroup(name='object-storage',
343 title='Object Storage Service Options')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200344
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500345ObjectStoreConfig = [
346 cfg.StrOpt('catalog_type',
347 default='object-store',
348 help="Catalog type of the Object-Storage service."),
nayna-patelb4989b32013-01-09 06:25:13 +0000349 cfg.StrOpt('container_sync_timeout',
350 default=120,
351 help="Number of seconds to time on waiting for a container"
352 "to container synchronization complete."),
353 cfg.StrOpt('container_sync_interval',
354 default=5,
355 help="Number of seconds to wait while looping to check the"
356 "status of a container to container synchronization"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500357]
Attila Fazekasa23f5002012-10-23 19:32:45 +0200358
Attila Fazekasa23f5002012-10-23 19:32:45 +0200359
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500360def register_object_storage_opts(conf):
361 conf.register_group(object_storage_group)
362 for opt in ObjectStoreConfig:
363 conf.register_opt(opt, group='object-storage')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200364
Steve Bakerc60e4e32013-05-06 15:22:41 +1200365
366orchestration_group = cfg.OptGroup(name='orchestration',
367 title='Orchestration Service Options')
368
369OrchestrationGroup = [
370 cfg.StrOpt('catalog_type',
371 default='orchestration',
372 help="Catalog type of the Orchestration service."),
373 cfg.BoolOpt('allow_tenant_isolation',
374 default=False,
375 help="Allows test cases to create/destroy tenants and "
376 "users. This option enables isolated test cases and "
377 "better parallel execution, but also requires that "
378 "OpenStack Identity API admin credentials are known."),
379 cfg.IntOpt('build_interval',
380 default=1,
381 help="Time in seconds between build status checks."),
382 cfg.IntOpt('build_timeout',
383 default=300,
384 help="Timeout in seconds to wait for a stack to build."),
385 cfg.BoolOpt('heat_available',
386 default=False,
387 help="Whether or not Heat is expected to be available"),
388 cfg.StrOpt('instance_type',
Steve Baker9e86b832013-05-22 15:40:28 +1200389 default='m1.micro',
Steve Bakerc60e4e32013-05-06 15:22:41 +1200390 help="Instance type for tests. Needs to be big enough for a "
391 "full OS plus the test workload"),
392 cfg.StrOpt('image_ref',
393 default=None,
394 help="Name of heat-cfntools enabled image to use when "
395 "launching test instances."),
396 cfg.StrOpt('keypair_name',
397 default=None,
398 help="Name of existing keypair to launch servers with."),
399]
400
401
402def register_orchestration_opts(conf):
403 conf.register_group(orchestration_group)
404 for opt in OrchestrationGroup:
405 conf.register_opt(opt, group='orchestration')
406
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500407boto_group = cfg.OptGroup(name='boto',
408 title='EC2/S3 options')
409BotoConfig = [
410 cfg.StrOpt('ec2_url',
411 default="http://localhost:8773/services/Cloud",
412 help="EC2 URL"),
413 cfg.StrOpt('s3_url',
414 default="http://localhost:8080",
415 help="S3 URL"),
416 cfg.StrOpt('aws_secret',
417 default=None,
418 help="AWS Secret Key",
419 secret=True),
420 cfg.StrOpt('aws_access',
421 default=None,
422 help="AWS Access Key"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500423 cfg.StrOpt('s3_materials_path',
424 default="/opt/stack/devstack/files/images/"
425 "s3-materials/cirros-0.3.0",
426 help="S3 Materials Path"),
427 cfg.StrOpt('ari_manifest',
428 default="cirros-0.3.0-x86_64-initrd.manifest.xml",
429 help="ARI Ramdisk Image manifest"),
430 cfg.StrOpt('ami_manifest',
431 default="cirros-0.3.0-x86_64-blank.img.manifest.xml",
432 help="AMI Machine Image manifest"),
433 cfg.StrOpt('aki_manifest',
434 default="cirros-0.3.0-x86_64-vmlinuz.manifest.xml",
435 help="AKI Kernel Image manifest"),
436 cfg.StrOpt('instance_type',
437 default="m1.tiny",
438 help="Instance type"),
439 cfg.IntOpt('http_socket_timeout',
440 default=3,
441 help="boto Http socket timeout"),
442 cfg.IntOpt('num_retries',
443 default=1,
444 help="boto num_retries on error"),
445 cfg.IntOpt('build_timeout',
446 default=60,
447 help="Status Change Timeout"),
448 cfg.IntOpt('build_interval',
449 default=1,
450 help="Status Change Test Interval"),
451]
Attila Fazekasf7f2d932012-12-13 09:14:38 +0100452
Attila Fazekasa23f5002012-10-23 19:32:45 +0200453
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500454def register_boto_opts(conf):
455 conf.register_group(boto_group)
456 for opt in BotoConfig:
457 conf.register_opt(opt, group='boto')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200458
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500459stress_group = cfg.OptGroup(name='stress', title='Stress Test Options')
460
461StressGroup = [
462 cfg.StrOpt('nova_logdir',
463 default=None,
464 help='Directory containing log files on the compute nodes'),
465 cfg.IntOpt('max_instances',
466 default=16,
467 help='Maximum number of instances to create during test.'),
468 cfg.StrOpt('controller',
469 default=None,
David Kranzb9d97502013-05-01 15:55:04 -0400470 help='Controller host.'),
471 # new stress options
472 cfg.StrOpt('target_controller',
473 default=None,
474 help='Controller host.'),
475 cfg.StrOpt('target_ssh_user',
476 default=None,
477 help='ssh user.'),
478 cfg.StrOpt('target_private_key_path',
479 default=None,
480 help='Path to private key.'),
481 cfg.StrOpt('target_logfiles',
482 default=None,
483 help='regexp for list of log files.'),
484 cfg.StrOpt('log_check_interval',
485 default=60,
486 help='time between log file error checks.')
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500487]
488
489
490def register_stress_opts(conf):
491 conf.register_group(stress_group)
492 for opt in StressGroup:
493 conf.register_opt(opt, group='stress')
494
Attila Fazekasa23f5002012-10-23 19:32:45 +0200495
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900496scenario_group = cfg.OptGroup(name='scenario', title='Scenario Test Options')
497
498ScenarioGroup = [
499 cfg.StrOpt('img_dir',
500 default='/opt/stack/new/devstack/files/images/'
501 'cirros-0.3.1-x86_64-uec',
502 help='Directory containing image files'),
503 cfg.StrOpt('ami_img_file',
504 default='cirros-0.3.1-x86_64-blank.img',
505 help='AMI image file name'),
506 cfg.StrOpt('ari_img_file',
507 default='cirros-0.3.1-x86_64-initrd',
508 help='ARI image file name'),
509 cfg.StrOpt('aki_img_file',
510 default='cirros-0.3.1-x86_64-vmlinuz',
511 help='AKI image file name'),
512 cfg.StrOpt('ssh_user',
513 default='cirros',
514 help='ssh username for the image file')
515]
516
517
518def register_scenario_opts(conf):
519 conf.register_group(scenario_group)
520 for opt in ScenarioGroup:
521 conf.register_opt(opt, group='scenario')
522
523
Jay Pipes3f981df2012-03-27 18:59:44 -0400524@singleton
525class TempestConfig:
Daryl Walleck1465d612011-11-02 02:22:15 -0500526 """Provides OpenStack configuration information."""
527
Brian Waldon738cd632011-12-12 18:45:09 -0500528 DEFAULT_CONFIG_DIR = os.path.join(
Zhongyue Luoa1343de2013-01-04 16:21:35 +0800529 os.path.abspath(os.path.dirname(os.path.dirname(__file__))),
Brian Waldon738cd632011-12-12 18:45:09 -0500530 "etc")
Daryl Walleck1465d612011-11-02 02:22:15 -0500531
Brian Waldon738cd632011-12-12 18:45:09 -0500532 DEFAULT_CONFIG_FILE = "tempest.conf"
533
534 def __init__(self):
535 """Initialize a configuration from a conf directory and conf file."""
Sean Dague2416cf32013-04-10 08:29:07 -0400536 config_files = []
537
538 failsafe_path = "/etc/tempest/" + self.DEFAULT_CONFIG_FILE
Brian Waldon738cd632011-12-12 18:45:09 -0500539
540 # Environment variables override defaults...
541 conf_dir = os.environ.get('TEMPEST_CONFIG_DIR',
Zhongyue Luo79d8d362012-09-25 13:49:27 +0800542 self.DEFAULT_CONFIG_DIR)
543 conf_file = os.environ.get('TEMPEST_CONFIG', self.DEFAULT_CONFIG_FILE)
Brian Waldon738cd632011-12-12 18:45:09 -0500544
Jay Pipes7f757632011-12-02 15:53:32 -0500545 path = os.path.join(conf_dir, conf_file)
546
Zhongyue Luoafd43eb2013-02-04 11:32:57 +0800547 if not (os.path.isfile(path) or
548 'TEMPEST_CONFIG_DIR' in os.environ or
549 'TEMPEST_CONFIG' in os.environ):
Sean Dague2416cf32013-04-10 08:29:07 -0400550 path = failsafe_path
Attila Fazekas5abb2532012-12-04 11:30:49 +0100551
Jay Pipes3f981df2012-03-27 18:59:44 -0400552 LOG.info("Using tempest config file %s" % path)
553
Jay Pipes7f757632011-12-02 15:53:32 -0500554 if not os.path.exists(path):
555 msg = "Config file %(path)s not found" % locals()
Attila Fazekas5abb2532012-12-04 11:30:49 +0100556 print >> sys.stderr, RuntimeError(msg)
Sean Dague2416cf32013-04-10 08:29:07 -0400557 else:
558 config_files.append(path)
Jay Pipes7f757632011-12-02 15:53:32 -0500559
Sean Dague2416cf32013-04-10 08:29:07 -0400560 cfg.CONF([], project='tempest', default_config_files=config_files)
Daryl Walleck1465d612011-11-02 02:22:15 -0500561
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500562 register_compute_opts(cfg.CONF)
563 register_identity_opts(cfg.CONF)
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100564 register_whitebox_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500565 register_image_opts(cfg.CONF)
566 register_network_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500567 register_volume_opts(cfg.CONF)
568 register_object_storage_opts(cfg.CONF)
Steve Bakerc60e4e32013-05-06 15:22:41 +1200569 register_orchestration_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500570 register_boto_opts(cfg.CONF)
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100571 register_compute_admin_opts(cfg.CONF)
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500572 register_stress_opts(cfg.CONF)
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900573 register_scenario_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500574 self.compute = cfg.CONF.compute
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100575 self.whitebox = cfg.CONF.whitebox
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500576 self.identity = cfg.CONF.identity
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500577 self.images = cfg.CONF.image
578 self.network = cfg.CONF.network
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500579 self.volume = cfg.CONF.volume
580 self.object_storage = cfg.CONF['object-storage']
Steve Bakerc60e4e32013-05-06 15:22:41 +1200581 self.orchestration = cfg.CONF.orchestration
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500582 self.boto = cfg.CONF.boto
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100583 self.compute_admin = cfg.CONF['compute-admin']
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500584 self.stress = cfg.CONF.stress
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900585 self.scenario = cfg.CONF.scenario
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100586 if not self.compute_admin.username:
587 self.compute_admin.username = self.identity.admin_username
588 self.compute_admin.password = self.identity.admin_password
589 self.compute_admin.tenant_name = self.identity.admin_tenant_name