Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 1 | # 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 Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 18 | from tempest import config |
Frederic Lepied | 80a8d4e | 2013-01-12 12:43:52 +0100 | [diff] [blame] | 19 | from tempest.exceptions import InvalidConfiguration |
Matthew Treinish | f4a9b0f | 2013-07-26 16:58:26 -0400 | [diff] [blame^] | 20 | from tempest.openstack.common import log as logging |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 21 | |
| 22 | LOG = logging.getLogger(__name__) |
| 23 | |
| 24 | CONFIG = config.TempestConfig() |
| 25 | CREATE_IMAGE_ENABLED = CONFIG.compute.create_image_enabled |
| 26 | RESIZE_AVAILABLE = CONFIG.compute.resize_available |
David Kranz | f97d5fd | 2012-07-30 13:46:45 -0400 | [diff] [blame] | 27 | CHANGE_PASSWORD_AVAILABLE = CONFIG.compute.change_password_available |
Attila Fazekas | 8695073 | 2013-06-08 09:33:08 +0200 | [diff] [blame] | 28 | DISK_CONFIG_ENABLED = CONFIG.compute.disk_config_enabled |
| 29 | FLAVOR_EXTRA_DATA_ENABLED = CONFIG.compute.flavor_extra_enabled |
Attila Fazekas | b3fb381 | 2013-02-15 13:16:38 +0100 | [diff] [blame] | 30 | MULTI_USER = True |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 31 | |
Daryl Walleck | ed97dca | 2012-07-04 23:25:45 -0500 | [diff] [blame] | 32 | |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 33 | # All compute tests -- single setup function |
Chris Yeoh | 8a79b9d | 2013-01-18 19:32:47 +1030 | [diff] [blame] | 34 | def generic_setup_package(): |
Sean Dague | 1937d09 | 2013-05-17 16:36:38 -0400 | [diff] [blame] | 35 | LOG.debug("Entering tempest.api.compute.setup_package") |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 36 | |
Attila Fazekas | 8695073 | 2013-06-08 09:33:08 +0200 | [diff] [blame] | 37 | global MULTI_USER |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 38 | |
| 39 | # Determine if there are two regular users that can be |
| 40 | # used in testing. If the test cases are allowed to create |
| 41 | # users (config.compute.allow_tenant_isolation is true, |
| 42 | # then we allow multi-user. |
Attila Fazekas | b3fb381 | 2013-02-15 13:16:38 +0100 | [diff] [blame] | 43 | if not CONFIG.compute.allow_tenant_isolation: |
Attila Fazekas | cadcb1f | 2013-01-21 23:10:53 +0100 | [diff] [blame] | 44 | user1 = CONFIG.identity.username |
| 45 | user2 = CONFIG.identity.alt_username |
Attila Fazekas | b3fb381 | 2013-02-15 13:16:38 +0100 | [diff] [blame] | 46 | if not user2 or user1 == user2: |
| 47 | MULTI_USER = False |
| 48 | else: |
Attila Fazekas | cadcb1f | 2013-01-21 23:10:53 +0100 | [diff] [blame] | 49 | user2_password = CONFIG.identity.alt_password |
| 50 | user2_tenant_name = CONFIG.identity.alt_tenant_name |
Dan Prince | ff3d5c6 | 2012-07-09 11:01:44 -0400 | [diff] [blame] | 51 | if not user2_password or not user2_tenant_name: |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 52 | msg = ("Alternate user specified but not alternate " |
Frederic Lepied | 80a8d4e | 2013-01-12 12:43:52 +0100 | [diff] [blame] | 53 | "tenant or password: alt_tenant_name=%s alt_password=%s" |
| 54 | % (user2_tenant_name, user2_password)) |
| 55 | raise InvalidConfiguration(msg) |