blob: fd260812ba40d798f809d136b00bb164d5044c2f [file] [log] [blame]
Jay Pipesf38eaac2012-06-21 13:37:35 -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 Pipesf38eaac2012-06-21 13:37:35 -040018from tempest import config
Frederic Lepied80a8d4e2013-01-12 12:43:52 +010019from tempest.exceptions import InvalidConfiguration
Matthew Treinishf4a9b0f2013-07-26 16:58:26 -040020from tempest.openstack.common import log as logging
Jay Pipesf38eaac2012-06-21 13:37:35 -040021
22LOG = logging.getLogger(__name__)
23
24CONFIG = config.TempestConfig()
25CREATE_IMAGE_ENABLED = CONFIG.compute.create_image_enabled
26RESIZE_AVAILABLE = CONFIG.compute.resize_available
David Kranzf97d5fd2012-07-30 13:46:45 -040027CHANGE_PASSWORD_AVAILABLE = CONFIG.compute.change_password_available
Attila Fazekas86950732013-06-08 09:33:08 +020028DISK_CONFIG_ENABLED = CONFIG.compute.disk_config_enabled
29FLAVOR_EXTRA_DATA_ENABLED = CONFIG.compute.flavor_extra_enabled
Attila Fazekasb3fb3812013-02-15 13:16:38 +010030MULTI_USER = True
Jay Pipesf38eaac2012-06-21 13:37:35 -040031
Daryl Wallecked97dca2012-07-04 23:25:45 -050032
Jay Pipesf38eaac2012-06-21 13:37:35 -040033# All compute tests -- single setup function
Chris Yeoh8a79b9d2013-01-18 19:32:47 +103034def generic_setup_package():
Sean Dague1937d092013-05-17 16:36:38 -040035 LOG.debug("Entering tempest.api.compute.setup_package")
Jay Pipesf38eaac2012-06-21 13:37:35 -040036
Attila Fazekas86950732013-06-08 09:33:08 +020037 global MULTI_USER
Jay Pipesf38eaac2012-06-21 13:37:35 -040038
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 Fazekasb3fb3812013-02-15 13:16:38 +010043 if not CONFIG.compute.allow_tenant_isolation:
Attila Fazekascadcb1f2013-01-21 23:10:53 +010044 user1 = CONFIG.identity.username
45 user2 = CONFIG.identity.alt_username
Attila Fazekasb3fb3812013-02-15 13:16:38 +010046 if not user2 or user1 == user2:
47 MULTI_USER = False
48 else:
Attila Fazekascadcb1f2013-01-21 23:10:53 +010049 user2_password = CONFIG.identity.alt_password
50 user2_tenant_name = CONFIG.identity.alt_tenant_name
Dan Princeff3d5c62012-07-09 11:01:44 -040051 if not user2_password or not user2_tenant_name:
Jay Pipesf38eaac2012-06-21 13:37:35 -040052 msg = ("Alternate user specified but not alternate "
Frederic Lepied80a8d4e2013-01-12 12:43:52 +010053 "tenant or password: alt_tenant_name=%s alt_password=%s"
54 % (user2_tenant_name, user2_password))
55 raise InvalidConfiguration(msg)