blob: 68acdaa060a1cf991c53c45ece688d09c7361fde [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."),
Nachi Ueno6d580be2013-07-24 10:58:11 -0700163 cfg.IntOpt('ping_timeout',
164 default=60,
165 help="Timeout in seconds to wait for ping to "
166 "succeed."),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500167 cfg.IntOpt('ssh_timeout',
168 default=300,
Chris Yeoh76916042013-02-27 16:25:25 +1030169 help="Timeout in seconds to wait for authentication to "
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500170 "succeed."),
Chris Yeoh76916042013-02-27 16:25:25 +1030171 cfg.IntOpt('ssh_channel_timeout',
172 default=60,
173 help="Timeout in seconds to wait for output from ssh "
174 "channel."),
Attila Fazekasb0661652013-05-08 13:01:36 +0200175 cfg.StrOpt('fixed_network_name',
176 default='private',
177 help="Visible fixed network name "),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500178 cfg.StrOpt('network_for_ssh',
179 default='public',
180 help="Network used for SSH connections."),
181 cfg.IntOpt('ip_version_for_ssh',
182 default=4,
183 help="IP version used for SSH connections."),
fujioka yuuichia11994e2013-07-09 11:19:51 +0900184 cfg.BoolOpt('use_floatingip_for_ssh',
185 default=True,
186 help="Dose the SSH uses Floating IP?"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500187 cfg.StrOpt('catalog_type',
188 default='compute',
189 help="Catalog type of the Compute service."),
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100190 cfg.StrOpt('path_to_private_key',
191 default=None,
192 help="Path to a private key file for SSH access to remote "
193 "hosts"),
Attila Fazekas86950732013-06-08 09:33:08 +0200194 cfg.BoolOpt('disk_config_enabled',
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100195 default=True,
Attila Fazekas86950732013-06-08 09:33:08 +0200196 help="If false, skip disk config tests"),
197 cfg.BoolOpt('flavor_extra_enabled',
198 default=True,
199 help="If false, skip flavor extra data test"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500200]
Rohit Karajgie1b050d2011-12-02 16:13:18 -0800201
Rohit Karajgie1b050d2011-12-02 16:13:18 -0800202
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500203def register_compute_opts(conf):
204 conf.register_group(compute_group)
205 for opt in ComputeGroup:
206 conf.register_opt(opt, group='compute')
kavan-patil4ea2efb2011-12-09 08:58:50 +0000207
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500208compute_admin_group = cfg.OptGroup(name='compute-admin',
209 title="Compute Admin Options")
donald-ngo7fb1efa2011-12-13 17:17:36 -0800210
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500211ComputeAdminGroup = [
212 cfg.StrOpt('username',
213 default='admin',
214 help="Administrative Username to use for Nova API requests."),
215 cfg.StrOpt('tenant_name',
216 default='admin',
217 help="Administrative Tenant name to use for Nova API "
218 "requests."),
219 cfg.StrOpt('password',
220 default='pass',
221 help="API key to use when authenticating as admin.",
222 secret=True),
223]
Daryl Walleck587385b2012-03-03 13:00:26 -0600224
K Jonathan Harkerd6ba4b42012-12-18 13:50:47 -0800225
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500226def register_compute_admin_opts(conf):
227 conf.register_group(compute_admin_group)
228 for opt in ComputeAdminGroup:
229 conf.register_opt(opt, group='compute-admin')
Daryl Walleck587385b2012-03-03 13:00:26 -0600230
Jay Pipesf38eaac2012-06-21 13:37:35 -0400231
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100232whitebox_group = cfg.OptGroup(name='whitebox',
233 title="Whitebox Options")
234
235WhiteboxGroup = [
236 cfg.BoolOpt('whitebox_enabled',
237 default=False,
238 help="Does the test environment support whitebox tests for "
239 "Compute?"),
240 cfg.StrOpt('db_uri',
241 default=None,
242 help="Connection string to the database of Compute service"),
243 cfg.StrOpt('source_dir',
244 default="/opt/stack/nova",
245 help="Path of nova source directory"),
246 cfg.StrOpt('config_path',
247 default='/etc/nova/nova.conf',
248 help="Path of nova configuration file"),
249 cfg.StrOpt('bin_dir',
250 default="/usr/local/bin/",
251 help="Directory containing nova binaries such as nova-manage"),
252]
253
254
255def register_whitebox_opts(conf):
256 conf.register_group(whitebox_group)
257 for opt in WhiteboxGroup:
258 conf.register_opt(opt, group='whitebox')
259
260
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500261image_group = cfg.OptGroup(name='image',
262 title="Image Service Options")
Jay Pipesf38eaac2012-06-21 13:37:35 -0400263
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500264ImageGroup = [
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500265 cfg.StrOpt('api_version',
266 default='1',
267 help="Version of the API"),
Matthew Treinish72ea4422013-02-07 14:42:49 -0500268 cfg.StrOpt('catalog_type',
269 default='image',
Sean Dague83401992013-05-06 17:46:36 -0400270 help='Catalog type of the Image service.'),
271 cfg.StrOpt('http_image',
272 default='http://download.cirros-cloud.net/0.3.1/'
273 'cirros-0.3.1-x86_64-uec.tar.gz',
274 help='http accessable image')
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500275]
Jay Pipesf38eaac2012-06-21 13:37:35 -0400276
Jay Pipesf38eaac2012-06-21 13:37:35 -0400277
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500278def register_image_opts(conf):
279 conf.register_group(image_group)
280 for opt in ImageGroup:
281 conf.register_opt(opt, group='image')
Jay Pipesf38eaac2012-06-21 13:37:35 -0400282
283
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500284network_group = cfg.OptGroup(name='network',
285 title='Network Service Options')
Daryl Walleck587385b2012-03-03 13:00:26 -0600286
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500287NetworkGroup = [
288 cfg.StrOpt('catalog_type',
289 default='network',
Mark McClainf2982e82013-07-06 17:48:03 -0400290 help='Catalog type of the Neutron service.'),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500291 cfg.StrOpt('tenant_network_cidr',
292 default="10.100.0.0/16",
293 help="The cidr block to allocate tenant networks from"),
294 cfg.IntOpt('tenant_network_mask_bits',
295 default=29,
296 help="The mask bits for tenant networks"),
297 cfg.BoolOpt('tenant_networks_reachable',
298 default=False,
299 help="Whether tenant network connectivity should be "
300 "evaluated directly"),
301 cfg.StrOpt('public_network_id',
302 default="",
303 help="Id of the public network that provides external "
304 "connectivity"),
305 cfg.StrOpt('public_router_id',
306 default="",
307 help="Id of the public router that provides external "
308 "connectivity"),
309]
Jay Pipes3f981df2012-03-27 18:59:44 -0400310
Jay Pipesf38eaac2012-06-21 13:37:35 -0400311
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500312def register_network_opts(conf):
313 conf.register_group(network_group)
314 for opt in NetworkGroup:
315 conf.register_opt(opt, group='network')
Dan Smithd6ff6b72012-08-23 10:29:41 -0700316
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500317volume_group = cfg.OptGroup(name='volume',
318 title='Block Storage Options')
Daryl Walleck587385b2012-03-03 13:00:26 -0600319
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500320VolumeGroup = [
321 cfg.IntOpt('build_interval',
322 default=10,
323 help='Time in seconds between volume availability checks.'),
324 cfg.IntOpt('build_timeout',
325 default=300,
326 help='Timeout in seconds to wait for a volume to become'
327 'available.'),
328 cfg.StrOpt('catalog_type',
329 default='Volume',
330 help="Catalog type of the Volume Service"),
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100331 cfg.BoolOpt('multi_backend_enabled',
332 default=False,
Giulio Fidentef4fa8942013-05-28 18:48:03 +0200333 help="Runs Cinder multi-backend test (requires 2 backends)"),
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100334 cfg.StrOpt('backend1_name',
Giulio Fidentef4fa8942013-05-28 18:48:03 +0200335 default='BACKEND_1',
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100336 help="Name of the backend1 (must be declared in cinder.conf)"),
337 cfg.StrOpt('backend2_name',
Giulio Fidentef4fa8942013-05-28 18:48:03 +0200338 default='BACKEND_2',
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100339 help="Name of the backend2 (must be declared in cinder.conf)"),
Adam Gandelman827ad332013-06-24 17:04:09 -0700340 cfg.StrOpt('storage_protocol',
341 default='iSCSI',
342 help='Backend protocol to target when creating volume types'),
343 cfg.StrOpt('vendor_name',
344 default='Open Source',
345 help='Backend vendor to target when creating volume types'),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500346]
K Jonathan Harkerd6ba4b42012-12-18 13:50:47 -0800347
Daryl Walleck587385b2012-03-03 13:00:26 -0600348
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500349def register_volume_opts(conf):
350 conf.register_group(volume_group)
351 for opt in VolumeGroup:
352 conf.register_opt(opt, group='volume')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200353
Attila Fazekasa23f5002012-10-23 19:32:45 +0200354
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500355object_storage_group = cfg.OptGroup(name='object-storage',
356 title='Object Storage Service Options')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200357
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500358ObjectStoreConfig = [
359 cfg.StrOpt('catalog_type',
360 default='object-store',
361 help="Catalog type of the Object-Storage service."),
nayna-patelb4989b32013-01-09 06:25:13 +0000362 cfg.StrOpt('container_sync_timeout',
363 default=120,
364 help="Number of seconds to time on waiting for a container"
365 "to container synchronization complete."),
366 cfg.StrOpt('container_sync_interval',
367 default=5,
368 help="Number of seconds to wait while looping to check the"
369 "status of a container to container synchronization"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500370]
Attila Fazekasa23f5002012-10-23 19:32:45 +0200371
Attila Fazekasa23f5002012-10-23 19:32:45 +0200372
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500373def register_object_storage_opts(conf):
374 conf.register_group(object_storage_group)
375 for opt in ObjectStoreConfig:
376 conf.register_opt(opt, group='object-storage')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200377
Steve Bakerc60e4e32013-05-06 15:22:41 +1200378
379orchestration_group = cfg.OptGroup(name='orchestration',
380 title='Orchestration Service Options')
381
382OrchestrationGroup = [
383 cfg.StrOpt('catalog_type',
384 default='orchestration',
385 help="Catalog type of the Orchestration service."),
386 cfg.BoolOpt('allow_tenant_isolation',
387 default=False,
388 help="Allows test cases to create/destroy tenants and "
389 "users. This option enables isolated test cases and "
390 "better parallel execution, but also requires that "
391 "OpenStack Identity API admin credentials are known."),
392 cfg.IntOpt('build_interval',
393 default=1,
394 help="Time in seconds between build status checks."),
395 cfg.IntOpt('build_timeout',
396 default=300,
397 help="Timeout in seconds to wait for a stack to build."),
Steve Bakerc60e4e32013-05-06 15:22:41 +1200398 cfg.StrOpt('instance_type',
Steve Baker9e86b832013-05-22 15:40:28 +1200399 default='m1.micro',
Steve Bakerc60e4e32013-05-06 15:22:41 +1200400 help="Instance type for tests. Needs to be big enough for a "
401 "full OS plus the test workload"),
402 cfg.StrOpt('image_ref',
403 default=None,
404 help="Name of heat-cfntools enabled image to use when "
405 "launching test instances."),
406 cfg.StrOpt('keypair_name',
407 default=None,
408 help="Name of existing keypair to launch servers with."),
409]
410
411
412def register_orchestration_opts(conf):
413 conf.register_group(orchestration_group)
414 for opt in OrchestrationGroup:
415 conf.register_opt(opt, group='orchestration')
416
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500417boto_group = cfg.OptGroup(name='boto',
418 title='EC2/S3 options')
419BotoConfig = [
420 cfg.StrOpt('ec2_url',
421 default="http://localhost:8773/services/Cloud",
422 help="EC2 URL"),
423 cfg.StrOpt('s3_url',
424 default="http://localhost:8080",
425 help="S3 URL"),
426 cfg.StrOpt('aws_secret',
427 default=None,
428 help="AWS Secret Key",
429 secret=True),
430 cfg.StrOpt('aws_access',
431 default=None,
432 help="AWS Access Key"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500433 cfg.StrOpt('s3_materials_path',
434 default="/opt/stack/devstack/files/images/"
435 "s3-materials/cirros-0.3.0",
436 help="S3 Materials Path"),
437 cfg.StrOpt('ari_manifest',
438 default="cirros-0.3.0-x86_64-initrd.manifest.xml",
439 help="ARI Ramdisk Image manifest"),
440 cfg.StrOpt('ami_manifest',
441 default="cirros-0.3.0-x86_64-blank.img.manifest.xml",
442 help="AMI Machine Image manifest"),
443 cfg.StrOpt('aki_manifest',
444 default="cirros-0.3.0-x86_64-vmlinuz.manifest.xml",
445 help="AKI Kernel Image manifest"),
446 cfg.StrOpt('instance_type',
447 default="m1.tiny",
448 help="Instance type"),
449 cfg.IntOpt('http_socket_timeout',
450 default=3,
451 help="boto Http socket timeout"),
452 cfg.IntOpt('num_retries',
453 default=1,
454 help="boto num_retries on error"),
455 cfg.IntOpt('build_timeout',
456 default=60,
457 help="Status Change Timeout"),
458 cfg.IntOpt('build_interval',
459 default=1,
460 help="Status Change Test Interval"),
461]
Attila Fazekasf7f2d932012-12-13 09:14:38 +0100462
Attila Fazekasa23f5002012-10-23 19:32:45 +0200463
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500464def register_boto_opts(conf):
465 conf.register_group(boto_group)
466 for opt in BotoConfig:
467 conf.register_opt(opt, group='boto')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200468
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500469stress_group = cfg.OptGroup(name='stress', title='Stress Test Options')
470
471StressGroup = [
472 cfg.StrOpt('nova_logdir',
473 default=None,
474 help='Directory containing log files on the compute nodes'),
475 cfg.IntOpt('max_instances',
476 default=16,
477 help='Maximum number of instances to create during test.'),
478 cfg.StrOpt('controller',
479 default=None,
David Kranzb9d97502013-05-01 15:55:04 -0400480 help='Controller host.'),
481 # new stress options
482 cfg.StrOpt('target_controller',
483 default=None,
484 help='Controller host.'),
485 cfg.StrOpt('target_ssh_user',
486 default=None,
487 help='ssh user.'),
488 cfg.StrOpt('target_private_key_path',
489 default=None,
490 help='Path to private key.'),
491 cfg.StrOpt('target_logfiles',
492 default=None,
493 help='regexp for list of log files.'),
494 cfg.StrOpt('log_check_interval',
495 default=60,
496 help='time between log file error checks.')
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500497]
498
499
500def register_stress_opts(conf):
501 conf.register_group(stress_group)
502 for opt in StressGroup:
503 conf.register_opt(opt, group='stress')
504
Attila Fazekasa23f5002012-10-23 19:32:45 +0200505
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900506scenario_group = cfg.OptGroup(name='scenario', title='Scenario Test Options')
507
508ScenarioGroup = [
509 cfg.StrOpt('img_dir',
510 default='/opt/stack/new/devstack/files/images/'
511 'cirros-0.3.1-x86_64-uec',
512 help='Directory containing image files'),
513 cfg.StrOpt('ami_img_file',
514 default='cirros-0.3.1-x86_64-blank.img',
515 help='AMI image file name'),
516 cfg.StrOpt('ari_img_file',
517 default='cirros-0.3.1-x86_64-initrd',
518 help='ARI image file name'),
519 cfg.StrOpt('aki_img_file',
520 default='cirros-0.3.1-x86_64-vmlinuz',
521 help='AKI image file name'),
522 cfg.StrOpt('ssh_user',
523 default='cirros',
Joe Gordonb5e10cd2013-07-10 15:51:12 +0000524 help='ssh username for the image file'),
525 cfg.IntOpt(
526 'large_ops_number',
527 default=0,
528 help="specifies how many resources to request at once. Used "
529 "for large operations testing.")
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900530]
531
532
533def register_scenario_opts(conf):
534 conf.register_group(scenario_group)
535 for opt in ScenarioGroup:
536 conf.register_opt(opt, group='scenario')
537
538
Matthew Treinish4c412922013-07-16 15:27:42 -0400539service_available_group = cfg.OptGroup(name="service_available",
540 title="Available OpenStack Services")
541
542ServiceAvailableGroup = [
543 cfg.BoolOpt('cinder',
544 default=True,
545 help="Whether or not cinder is expected to be available"),
Matthew Treinishfaa340d2013-07-19 16:26:21 -0400546 cfg.BoolOpt('neutron',
547 default=False,
548 help="Whether or not neutron is expected to be available"),
Matthew Treinish853ae442013-07-19 16:36:07 -0400549 cfg.BoolOpt('glance',
550 default=True,
551 help="Whether or not glance is expected to be available"),
Matthew Treinish61e332b2013-07-19 16:42:31 -0400552 cfg.BoolOpt('swift',
553 default=True,
554 help="Whether or not swift is expected to be available"),
Matthew Treinish6b41e242013-07-19 16:49:28 -0400555 cfg.BoolOpt('nova',
556 default=True,
557 help="Whether or not nova is expected to be available"),
Matthew Treinisha9d43882013-07-19 16:54:52 -0400558 cfg.BoolOpt('heat',
559 default=False,
560 help="Whether or not Heat is expected to be available"),
Matthew Treinish4c412922013-07-16 15:27:42 -0400561]
562
563
564def register_service_available_opts(conf):
565 conf.register_group(scenario_group)
566 for opt in ServiceAvailableGroup:
567 conf.register_opt(opt, group='service_available')
568
569
Jay Pipes3f981df2012-03-27 18:59:44 -0400570@singleton
571class TempestConfig:
Daryl Walleck1465d612011-11-02 02:22:15 -0500572 """Provides OpenStack configuration information."""
573
Brian Waldon738cd632011-12-12 18:45:09 -0500574 DEFAULT_CONFIG_DIR = os.path.join(
Zhongyue Luoa1343de2013-01-04 16:21:35 +0800575 os.path.abspath(os.path.dirname(os.path.dirname(__file__))),
Brian Waldon738cd632011-12-12 18:45:09 -0500576 "etc")
Daryl Walleck1465d612011-11-02 02:22:15 -0500577
Brian Waldon738cd632011-12-12 18:45:09 -0500578 DEFAULT_CONFIG_FILE = "tempest.conf"
579
580 def __init__(self):
581 """Initialize a configuration from a conf directory and conf file."""
Sean Dague2416cf32013-04-10 08:29:07 -0400582 config_files = []
583
584 failsafe_path = "/etc/tempest/" + self.DEFAULT_CONFIG_FILE
Brian Waldon738cd632011-12-12 18:45:09 -0500585
586 # Environment variables override defaults...
587 conf_dir = os.environ.get('TEMPEST_CONFIG_DIR',
Zhongyue Luo79d8d362012-09-25 13:49:27 +0800588 self.DEFAULT_CONFIG_DIR)
589 conf_file = os.environ.get('TEMPEST_CONFIG', self.DEFAULT_CONFIG_FILE)
Brian Waldon738cd632011-12-12 18:45:09 -0500590
Jay Pipes7f757632011-12-02 15:53:32 -0500591 path = os.path.join(conf_dir, conf_file)
592
Zhongyue Luoafd43eb2013-02-04 11:32:57 +0800593 if not (os.path.isfile(path) or
594 'TEMPEST_CONFIG_DIR' in os.environ or
595 'TEMPEST_CONFIG' in os.environ):
Sean Dague2416cf32013-04-10 08:29:07 -0400596 path = failsafe_path
Attila Fazekas5abb2532012-12-04 11:30:49 +0100597
Jay Pipes3f981df2012-03-27 18:59:44 -0400598 LOG.info("Using tempest config file %s" % path)
599
Jay Pipes7f757632011-12-02 15:53:32 -0500600 if not os.path.exists(path):
Sean Dague43cd9052013-07-19 12:20:04 -0400601 msg = "Config file %s not found" % path
Dirk Muellere746fc22013-06-29 16:29:29 +0200602 print(RuntimeError(msg), file=sys.stderr)
Sean Dague2416cf32013-04-10 08:29:07 -0400603 else:
604 config_files.append(path)
Jay Pipes7f757632011-12-02 15:53:32 -0500605
Sean Dague2416cf32013-04-10 08:29:07 -0400606 cfg.CONF([], project='tempest', default_config_files=config_files)
Daryl Walleck1465d612011-11-02 02:22:15 -0500607
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500608 register_compute_opts(cfg.CONF)
609 register_identity_opts(cfg.CONF)
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100610 register_whitebox_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500611 register_image_opts(cfg.CONF)
612 register_network_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500613 register_volume_opts(cfg.CONF)
614 register_object_storage_opts(cfg.CONF)
Steve Bakerc60e4e32013-05-06 15:22:41 +1200615 register_orchestration_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500616 register_boto_opts(cfg.CONF)
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100617 register_compute_admin_opts(cfg.CONF)
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500618 register_stress_opts(cfg.CONF)
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900619 register_scenario_opts(cfg.CONF)
Matthew Treinish4c412922013-07-16 15:27:42 -0400620 register_service_available_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500621 self.compute = cfg.CONF.compute
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100622 self.whitebox = cfg.CONF.whitebox
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500623 self.identity = cfg.CONF.identity
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500624 self.images = cfg.CONF.image
625 self.network = cfg.CONF.network
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500626 self.volume = cfg.CONF.volume
627 self.object_storage = cfg.CONF['object-storage']
Steve Bakerc60e4e32013-05-06 15:22:41 +1200628 self.orchestration = cfg.CONF.orchestration
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500629 self.boto = cfg.CONF.boto
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100630 self.compute_admin = cfg.CONF['compute-admin']
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500631 self.stress = cfg.CONF.stress
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900632 self.scenario = cfg.CONF.scenario
Matthew Treinish4c412922013-07-16 15:27:42 -0400633 self.service_available = cfg.CONF.service_available
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100634 if not self.compute_admin.username:
635 self.compute_admin.username = self.identity.admin_username
636 self.compute_admin.password = self.identity.admin_password
637 self.compute_admin.tenant_name = self.identity.admin_tenant_name