59 lines
2.3 KiB
Python
59 lines
2.3 KiB
Python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
|
|
# Copyright 2012 OpenStack, LLC
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from fuel import clients
|
|
from fuel.common import log as logging
|
|
from fuel import config
|
|
from fuel.exceptions import InvalidConfiguration
|
|
|
|
LOG = logging.getLogger(__name__)
|
|
|
|
CONFIG = config.FuelConfig()
|
|
CREATE_IMAGE_ENABLED = CONFIG.compute.create_image_enabled
|
|
RESIZE_AVAILABLE = CONFIG.compute.resize_available
|
|
CHANGE_PASSWORD_AVAILABLE = CONFIG.compute.change_password_available
|
|
DISK_CONFIG_ENABLED = True
|
|
DISK_CONFIG_ENABLED_OVERRIDE = CONFIG.compute.disk_config_enabled_override
|
|
FLAVOR_EXTRA_DATA_ENABLED = True
|
|
MULTI_USER = True
|
|
|
|
|
|
# All compute tests -- single setup function
|
|
def generic_setup_package():
|
|
LOG.debug("Entering fuel.setup_package")
|
|
|
|
global MULTI_USER, DISK_CONFIG_ENABLED, FLAVOR_EXTRA_DATA_ENABLED
|
|
os = clients.Manager()
|
|
|
|
# Determine if there are two regular users that can be
|
|
# used in testing. If the test cases are allowed to create
|
|
# users (config.compute.allow_tenant_isolation is true,
|
|
# then we allow multi-user.
|
|
if not CONFIG.compute.allow_tenant_isolation:
|
|
user1 = CONFIG.identity.username
|
|
user2 = CONFIG.identity.alt_username
|
|
if not user2 or user1 == user2:
|
|
MULTI_USER = False
|
|
else:
|
|
user2_password = CONFIG.identity.alt_password
|
|
user2_tenant_name = CONFIG.identity.alt_tenant_name
|
|
if not user2_password or not user2_tenant_name:
|
|
msg = ("Alternate user specified but not alternate "
|
|
"tenant or password: alt_tenant_name=%s alt_password=%s"
|
|
% (user2_tenant_name, user2_password))
|
|
raise InvalidConfiguration(msg)
|