blob: d0dcc413f9d4e8a49ab4dfd6a8e959a9ed7a65f4 [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."),
fujioka yuuichia11994e2013-07-09 11:19:51 +0900180 cfg.BoolOpt('use_floatingip_for_ssh',
181 default=True,
182 help="Dose the SSH uses Floating IP?"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500183 cfg.StrOpt('catalog_type',
184 default='compute',
185 help="Catalog type of the Compute service."),
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100186 cfg.StrOpt('path_to_private_key',
187 default=None,
188 help="Path to a private key file for SSH access to remote "
189 "hosts"),
Attila Fazekas86950732013-06-08 09:33:08 +0200190 cfg.BoolOpt('disk_config_enabled',
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100191 default=True,
Attila Fazekas86950732013-06-08 09:33:08 +0200192 help="If false, skip disk config tests"),
193 cfg.BoolOpt('flavor_extra_enabled',
194 default=True,
195 help="If false, skip flavor extra data test"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500196]
Rohit Karajgie1b050d2011-12-02 16:13:18 -0800197
Rohit Karajgie1b050d2011-12-02 16:13:18 -0800198
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500199def register_compute_opts(conf):
200 conf.register_group(compute_group)
201 for opt in ComputeGroup:
202 conf.register_opt(opt, group='compute')
kavan-patil4ea2efb2011-12-09 08:58:50 +0000203
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500204compute_admin_group = cfg.OptGroup(name='compute-admin',
205 title="Compute Admin Options")
donald-ngo7fb1efa2011-12-13 17:17:36 -0800206
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500207ComputeAdminGroup = [
208 cfg.StrOpt('username',
209 default='admin',
210 help="Administrative Username to use for Nova API requests."),
211 cfg.StrOpt('tenant_name',
212 default='admin',
213 help="Administrative Tenant name to use for Nova API "
214 "requests."),
215 cfg.StrOpt('password',
216 default='pass',
217 help="API key to use when authenticating as admin.",
218 secret=True),
219]
Daryl Walleck587385b2012-03-03 13:00:26 -0600220
K Jonathan Harkerd6ba4b42012-12-18 13:50:47 -0800221
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500222def register_compute_admin_opts(conf):
223 conf.register_group(compute_admin_group)
224 for opt in ComputeAdminGroup:
225 conf.register_opt(opt, group='compute-admin')
Daryl Walleck587385b2012-03-03 13:00:26 -0600226
Jay Pipesf38eaac2012-06-21 13:37:35 -0400227
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100228whitebox_group = cfg.OptGroup(name='whitebox',
229 title="Whitebox Options")
230
231WhiteboxGroup = [
232 cfg.BoolOpt('whitebox_enabled',
233 default=False,
234 help="Does the test environment support whitebox tests for "
235 "Compute?"),
236 cfg.StrOpt('db_uri',
237 default=None,
238 help="Connection string to the database of Compute service"),
239 cfg.StrOpt('source_dir',
240 default="/opt/stack/nova",
241 help="Path of nova source directory"),
242 cfg.StrOpt('config_path',
243 default='/etc/nova/nova.conf',
244 help="Path of nova configuration file"),
245 cfg.StrOpt('bin_dir',
246 default="/usr/local/bin/",
247 help="Directory containing nova binaries such as nova-manage"),
248]
249
250
251def register_whitebox_opts(conf):
252 conf.register_group(whitebox_group)
253 for opt in WhiteboxGroup:
254 conf.register_opt(opt, group='whitebox')
255
256
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500257image_group = cfg.OptGroup(name='image',
258 title="Image Service Options")
Jay Pipesf38eaac2012-06-21 13:37:35 -0400259
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500260ImageGroup = [
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500261 cfg.StrOpt('api_version',
262 default='1',
263 help="Version of the API"),
Matthew Treinish72ea4422013-02-07 14:42:49 -0500264 cfg.StrOpt('catalog_type',
265 default='image',
Sean Dague83401992013-05-06 17:46:36 -0400266 help='Catalog type of the Image service.'),
267 cfg.StrOpt('http_image',
268 default='http://download.cirros-cloud.net/0.3.1/'
269 'cirros-0.3.1-x86_64-uec.tar.gz',
270 help='http accessable image')
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500271]
Jay Pipesf38eaac2012-06-21 13:37:35 -0400272
Jay Pipesf38eaac2012-06-21 13:37:35 -0400273
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500274def register_image_opts(conf):
275 conf.register_group(image_group)
276 for opt in ImageGroup:
277 conf.register_opt(opt, group='image')
Jay Pipesf38eaac2012-06-21 13:37:35 -0400278
279
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500280network_group = cfg.OptGroup(name='network',
281 title='Network Service Options')
Daryl Walleck587385b2012-03-03 13:00:26 -0600282
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500283NetworkGroup = [
284 cfg.StrOpt('catalog_type',
285 default='network',
Mark McClainf2982e82013-07-06 17:48:03 -0400286 help='Catalog type of the Neutron service.'),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500287 cfg.StrOpt('tenant_network_cidr',
288 default="10.100.0.0/16",
289 help="The cidr block to allocate tenant networks from"),
290 cfg.IntOpt('tenant_network_mask_bits',
291 default=29,
292 help="The mask bits for tenant networks"),
293 cfg.BoolOpt('tenant_networks_reachable',
294 default=False,
295 help="Whether tenant network connectivity should be "
296 "evaluated directly"),
297 cfg.StrOpt('public_network_id',
298 default="",
299 help="Id of the public network that provides external "
300 "connectivity"),
301 cfg.StrOpt('public_router_id',
302 default="",
303 help="Id of the public router that provides external "
304 "connectivity"),
Mark McClainf2982e82013-07-06 17:48:03 -0400305 cfg.BoolOpt('neutron_available',
Dan Smithd6c1f882013-02-26 15:50:11 -0500306 default=False,
Mark McClainf2982e82013-07-06 17:48:03 -0400307 help="Whether or not neutron is expected to be available"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500308]
Jay Pipes3f981df2012-03-27 18:59:44 -0400309
Jay Pipesf38eaac2012-06-21 13:37:35 -0400310
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500311def register_network_opts(conf):
312 conf.register_group(network_group)
313 for opt in NetworkGroup:
314 conf.register_opt(opt, group='network')
Dan Smithd6ff6b72012-08-23 10:29:41 -0700315
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500316volume_group = cfg.OptGroup(name='volume',
317 title='Block Storage Options')
Daryl Walleck587385b2012-03-03 13:00:26 -0600318
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500319VolumeGroup = [
320 cfg.IntOpt('build_interval',
321 default=10,
322 help='Time in seconds between volume availability checks.'),
323 cfg.IntOpt('build_timeout',
324 default=300,
325 help='Timeout in seconds to wait for a volume to become'
326 'available.'),
327 cfg.StrOpt('catalog_type',
328 default='Volume',
329 help="Catalog type of the Volume Service"),
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100330 cfg.BoolOpt('multi_backend_enabled',
331 default=False,
Giulio Fidentef4fa8942013-05-28 18:48:03 +0200332 help="Runs Cinder multi-backend test (requires 2 backends)"),
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100333 cfg.StrOpt('backend1_name',
Giulio Fidentef4fa8942013-05-28 18:48:03 +0200334 default='BACKEND_1',
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100335 help="Name of the backend1 (must be declared in cinder.conf)"),
336 cfg.StrOpt('backend2_name',
Giulio Fidentef4fa8942013-05-28 18:48:03 +0200337 default='BACKEND_2',
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100338 help="Name of the backend2 (must be declared in cinder.conf)"),
Adam Gandelman827ad332013-06-24 17:04:09 -0700339 cfg.StrOpt('storage_protocol',
340 default='iSCSI',
341 help='Backend protocol to target when creating volume types'),
342 cfg.StrOpt('vendor_name',
343 default='Open Source',
344 help='Backend vendor to target when creating volume types'),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500345]
K Jonathan Harkerd6ba4b42012-12-18 13:50:47 -0800346
Daryl Walleck587385b2012-03-03 13:00:26 -0600347
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500348def register_volume_opts(conf):
349 conf.register_group(volume_group)
350 for opt in VolumeGroup:
351 conf.register_opt(opt, group='volume')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200352
Attila Fazekasa23f5002012-10-23 19:32:45 +0200353
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500354object_storage_group = cfg.OptGroup(name='object-storage',
355 title='Object Storage Service Options')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200356
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500357ObjectStoreConfig = [
358 cfg.StrOpt('catalog_type',
359 default='object-store',
360 help="Catalog type of the Object-Storage service."),
nayna-patelb4989b32013-01-09 06:25:13 +0000361 cfg.StrOpt('container_sync_timeout',
362 default=120,
363 help="Number of seconds to time on waiting for a container"
364 "to container synchronization complete."),
365 cfg.StrOpt('container_sync_interval',
366 default=5,
367 help="Number of seconds to wait while looping to check the"
368 "status of a container to container synchronization"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500369]
Attila Fazekasa23f5002012-10-23 19:32:45 +0200370
Attila Fazekasa23f5002012-10-23 19:32:45 +0200371
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500372def register_object_storage_opts(conf):
373 conf.register_group(object_storage_group)
374 for opt in ObjectStoreConfig:
375 conf.register_opt(opt, group='object-storage')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200376
Steve Bakerc60e4e32013-05-06 15:22:41 +1200377
378orchestration_group = cfg.OptGroup(name='orchestration',
379 title='Orchestration Service Options')
380
381OrchestrationGroup = [
382 cfg.StrOpt('catalog_type',
383 default='orchestration',
384 help="Catalog type of the Orchestration service."),
385 cfg.BoolOpt('allow_tenant_isolation',
386 default=False,
387 help="Allows test cases to create/destroy tenants and "
388 "users. This option enables isolated test cases and "
389 "better parallel execution, but also requires that "
390 "OpenStack Identity API admin credentials are known."),
391 cfg.IntOpt('build_interval',
392 default=1,
393 help="Time in seconds between build status checks."),
394 cfg.IntOpt('build_timeout',
395 default=300,
396 help="Timeout in seconds to wait for a stack to build."),
397 cfg.BoolOpt('heat_available',
398 default=False,
399 help="Whether or not Heat is expected to be available"),
400 cfg.StrOpt('instance_type',
Steve Baker9e86b832013-05-22 15:40:28 +1200401 default='m1.micro',
Steve Bakerc60e4e32013-05-06 15:22:41 +1200402 help="Instance type for tests. Needs to be big enough for a "
403 "full OS plus the test workload"),
404 cfg.StrOpt('image_ref',
405 default=None,
406 help="Name of heat-cfntools enabled image to use when "
407 "launching test instances."),
408 cfg.StrOpt('keypair_name',
409 default=None,
410 help="Name of existing keypair to launch servers with."),
411]
412
413
414def register_orchestration_opts(conf):
415 conf.register_group(orchestration_group)
416 for opt in OrchestrationGroup:
417 conf.register_opt(opt, group='orchestration')
418
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500419boto_group = cfg.OptGroup(name='boto',
420 title='EC2/S3 options')
421BotoConfig = [
422 cfg.StrOpt('ec2_url',
423 default="http://localhost:8773/services/Cloud",
424 help="EC2 URL"),
425 cfg.StrOpt('s3_url',
426 default="http://localhost:8080",
427 help="S3 URL"),
428 cfg.StrOpt('aws_secret',
429 default=None,
430 help="AWS Secret Key",
431 secret=True),
432 cfg.StrOpt('aws_access',
433 default=None,
434 help="AWS Access Key"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500435 cfg.StrOpt('s3_materials_path',
436 default="/opt/stack/devstack/files/images/"
437 "s3-materials/cirros-0.3.0",
438 help="S3 Materials Path"),
439 cfg.StrOpt('ari_manifest',
440 default="cirros-0.3.0-x86_64-initrd.manifest.xml",
441 help="ARI Ramdisk Image manifest"),
442 cfg.StrOpt('ami_manifest',
443 default="cirros-0.3.0-x86_64-blank.img.manifest.xml",
444 help="AMI Machine Image manifest"),
445 cfg.StrOpt('aki_manifest',
446 default="cirros-0.3.0-x86_64-vmlinuz.manifest.xml",
447 help="AKI Kernel Image manifest"),
448 cfg.StrOpt('instance_type',
449 default="m1.tiny",
450 help="Instance type"),
451 cfg.IntOpt('http_socket_timeout',
452 default=3,
453 help="boto Http socket timeout"),
454 cfg.IntOpt('num_retries',
455 default=1,
456 help="boto num_retries on error"),
457 cfg.IntOpt('build_timeout',
458 default=60,
459 help="Status Change Timeout"),
460 cfg.IntOpt('build_interval',
461 default=1,
462 help="Status Change Test Interval"),
463]
Attila Fazekasf7f2d932012-12-13 09:14:38 +0100464
Attila Fazekasa23f5002012-10-23 19:32:45 +0200465
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500466def register_boto_opts(conf):
467 conf.register_group(boto_group)
468 for opt in BotoConfig:
469 conf.register_opt(opt, group='boto')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200470
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500471stress_group = cfg.OptGroup(name='stress', title='Stress Test Options')
472
473StressGroup = [
474 cfg.StrOpt('nova_logdir',
475 default=None,
476 help='Directory containing log files on the compute nodes'),
477 cfg.IntOpt('max_instances',
478 default=16,
479 help='Maximum number of instances to create during test.'),
480 cfg.StrOpt('controller',
481 default=None,
David Kranzb9d97502013-05-01 15:55:04 -0400482 help='Controller host.'),
483 # new stress options
484 cfg.StrOpt('target_controller',
485 default=None,
486 help='Controller host.'),
487 cfg.StrOpt('target_ssh_user',
488 default=None,
489 help='ssh user.'),
490 cfg.StrOpt('target_private_key_path',
491 default=None,
492 help='Path to private key.'),
493 cfg.StrOpt('target_logfiles',
494 default=None,
495 help='regexp for list of log files.'),
496 cfg.StrOpt('log_check_interval',
497 default=60,
498 help='time between log file error checks.')
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500499]
500
501
502def register_stress_opts(conf):
503 conf.register_group(stress_group)
504 for opt in StressGroup:
505 conf.register_opt(opt, group='stress')
506
Attila Fazekasa23f5002012-10-23 19:32:45 +0200507
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900508scenario_group = cfg.OptGroup(name='scenario', title='Scenario Test Options')
509
510ScenarioGroup = [
511 cfg.StrOpt('img_dir',
512 default='/opt/stack/new/devstack/files/images/'
513 'cirros-0.3.1-x86_64-uec',
514 help='Directory containing image files'),
515 cfg.StrOpt('ami_img_file',
516 default='cirros-0.3.1-x86_64-blank.img',
517 help='AMI image file name'),
518 cfg.StrOpt('ari_img_file',
519 default='cirros-0.3.1-x86_64-initrd',
520 help='ARI image file name'),
521 cfg.StrOpt('aki_img_file',
522 default='cirros-0.3.1-x86_64-vmlinuz',
523 help='AKI image file name'),
524 cfg.StrOpt('ssh_user',
525 default='cirros',
Joe Gordonb5e10cd2013-07-10 15:51:12 +0000526 help='ssh username for the image file'),
527 cfg.IntOpt(
528 'large_ops_number',
529 default=0,
530 help="specifies how many resources to request at once. Used "
531 "for large operations testing.")
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900532]
533
534
535def register_scenario_opts(conf):
536 conf.register_group(scenario_group)
537 for opt in ScenarioGroup:
538 conf.register_opt(opt, group='scenario')
539
540
Matthew Treinish4c412922013-07-16 15:27:42 -0400541service_available_group = cfg.OptGroup(name="service_available",
542 title="Available OpenStack Services")
543
544ServiceAvailableGroup = [
545 cfg.BoolOpt('cinder',
546 default=True,
547 help="Whether or not cinder is expected to be available"),
548]
549
550
551def register_service_available_opts(conf):
552 conf.register_group(scenario_group)
553 for opt in ServiceAvailableGroup:
554 conf.register_opt(opt, group='service_available')
555
556
Jay Pipes3f981df2012-03-27 18:59:44 -0400557@singleton
558class TempestConfig:
Daryl Walleck1465d612011-11-02 02:22:15 -0500559 """Provides OpenStack configuration information."""
560
Brian Waldon738cd632011-12-12 18:45:09 -0500561 DEFAULT_CONFIG_DIR = os.path.join(
Zhongyue Luoa1343de2013-01-04 16:21:35 +0800562 os.path.abspath(os.path.dirname(os.path.dirname(__file__))),
Brian Waldon738cd632011-12-12 18:45:09 -0500563 "etc")
Daryl Walleck1465d612011-11-02 02:22:15 -0500564
Brian Waldon738cd632011-12-12 18:45:09 -0500565 DEFAULT_CONFIG_FILE = "tempest.conf"
566
567 def __init__(self):
568 """Initialize a configuration from a conf directory and conf file."""
Sean Dague2416cf32013-04-10 08:29:07 -0400569 config_files = []
570
571 failsafe_path = "/etc/tempest/" + self.DEFAULT_CONFIG_FILE
Brian Waldon738cd632011-12-12 18:45:09 -0500572
573 # Environment variables override defaults...
574 conf_dir = os.environ.get('TEMPEST_CONFIG_DIR',
Zhongyue Luo79d8d362012-09-25 13:49:27 +0800575 self.DEFAULT_CONFIG_DIR)
576 conf_file = os.environ.get('TEMPEST_CONFIG', self.DEFAULT_CONFIG_FILE)
Brian Waldon738cd632011-12-12 18:45:09 -0500577
Jay Pipes7f757632011-12-02 15:53:32 -0500578 path = os.path.join(conf_dir, conf_file)
579
Zhongyue Luoafd43eb2013-02-04 11:32:57 +0800580 if not (os.path.isfile(path) or
581 'TEMPEST_CONFIG_DIR' in os.environ or
582 'TEMPEST_CONFIG' in os.environ):
Sean Dague2416cf32013-04-10 08:29:07 -0400583 path = failsafe_path
Attila Fazekas5abb2532012-12-04 11:30:49 +0100584
Jay Pipes3f981df2012-03-27 18:59:44 -0400585 LOG.info("Using tempest config file %s" % path)
586
Jay Pipes7f757632011-12-02 15:53:32 -0500587 if not os.path.exists(path):
Sean Dague43cd9052013-07-19 12:20:04 -0400588 msg = "Config file %s not found" % path
Dirk Muellere746fc22013-06-29 16:29:29 +0200589 print(RuntimeError(msg), file=sys.stderr)
Sean Dague2416cf32013-04-10 08:29:07 -0400590 else:
591 config_files.append(path)
Jay Pipes7f757632011-12-02 15:53:32 -0500592
Sean Dague2416cf32013-04-10 08:29:07 -0400593 cfg.CONF([], project='tempest', default_config_files=config_files)
Daryl Walleck1465d612011-11-02 02:22:15 -0500594
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500595 register_compute_opts(cfg.CONF)
596 register_identity_opts(cfg.CONF)
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100597 register_whitebox_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500598 register_image_opts(cfg.CONF)
599 register_network_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500600 register_volume_opts(cfg.CONF)
601 register_object_storage_opts(cfg.CONF)
Steve Bakerc60e4e32013-05-06 15:22:41 +1200602 register_orchestration_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500603 register_boto_opts(cfg.CONF)
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100604 register_compute_admin_opts(cfg.CONF)
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500605 register_stress_opts(cfg.CONF)
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900606 register_scenario_opts(cfg.CONF)
Matthew Treinish4c412922013-07-16 15:27:42 -0400607 register_service_available_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500608 self.compute = cfg.CONF.compute
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100609 self.whitebox = cfg.CONF.whitebox
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500610 self.identity = cfg.CONF.identity
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500611 self.images = cfg.CONF.image
612 self.network = cfg.CONF.network
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500613 self.volume = cfg.CONF.volume
614 self.object_storage = cfg.CONF['object-storage']
Steve Bakerc60e4e32013-05-06 15:22:41 +1200615 self.orchestration = cfg.CONF.orchestration
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500616 self.boto = cfg.CONF.boto
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100617 self.compute_admin = cfg.CONF['compute-admin']
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500618 self.stress = cfg.CONF.stress
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900619 self.scenario = cfg.CONF.scenario
Matthew Treinish4c412922013-07-16 15:27:42 -0400620 self.service_available = cfg.CONF.service_available
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100621 if not self.compute_admin.username:
622 self.compute_admin.username = self.identity.admin_username
623 self.compute_admin.password = self.identity.admin_password
624 self.compute_admin.tenant_name = self.identity.admin_tenant_name