Merge "Add fullstack test for manila provider"
This commit is contained in:
commit
976b301db8
|
@ -13,5 +13,10 @@ ADMIN_PASSWORD=pass
|
|||
# If you want to use stable kuryr lib, please comment out this line.
|
||||
LIBS_FROM_GIT=kuryr
|
||||
|
||||
# Manila provider options
|
||||
MANILA_DEFAULT_SHARE_TYPE_EXTRA_SPECS='snapshot_support=True create_share_from_snapshot_support=True revert_to_snapshot_support=True mount_snapshot_support=True'
|
||||
SHARE_DRIVER=manila.share.drivers.lvm.LVMShareDriver
|
||||
MANILA_OPTGROUP_generic1_driver_handles_share_servers=False
|
||||
|
||||
enable_plugin fuxi https://git.openstack.org/openstack/fuxi
|
||||
enable_plugin manila https://github.com/openstack/manila
|
||||
|
|
|
@ -55,10 +55,12 @@ function configure_fuxi {
|
|||
if is_service_enabled fuxi; then
|
||||
configure_auth_token_middleware $FUXI_CONFIG fuxi \
|
||||
$FUXI_AUTH_CACHE_DIR cinder
|
||||
configure_auth_token_middleware $FUXI_CONFIG fuxi \
|
||||
$FUXI_AUTH_CACHE_DIR manila
|
||||
|
||||
iniset $FUXI_CONFIG DEFAULT fuxi_port 7879
|
||||
iniset $FUXI_CONFIG DEFAULT my_ip $HOST_IP
|
||||
iniset $FUXI_CONFIG DEFAULT volume_providers cinder
|
||||
iniset $FUXI_CONFIG DEFAULT volume_providers cinder,manila
|
||||
iniset $FUXI_CONFIG DEFAULT volume_from fuxi
|
||||
iniset $FUXI_CONFIG DEFAULT default_volume_size 1
|
||||
iniset $FUXI_CONFIG DEFAULT volume_dir /fuxi/data
|
||||
|
|
|
@ -8,5 +8,8 @@ GATE_DEST=$BASE/new
|
|||
DEVSTACK_PATH=$GATE_DEST/devstack
|
||||
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin manila git://git.openstack.org/openstack/manila"
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"MANILA_DEFAULT_SHARE_TYPE_EXTRA_SPECS='snapshot_support=True create_share_from_snapshot_support=True revert_to_snapshot_support=True mount_snapshot_support=True'"
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"SHARE_DRIVER=manila.share.drivers.lvm.LVMShareDriver"
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"MANILA_OPTGROUP_generic1_driver_handles_share_servers=False"
|
||||
|
||||
$BASE/new/devstack-gate/devstack-vm-gate.sh
|
||||
|
|
|
@ -17,6 +17,7 @@ from cinderclient.v2 import client
|
|||
from fuxi.i18n import _LW
|
||||
from keystoneauth1 import identity
|
||||
from keystoneauth1 import session as ks
|
||||
from manilaclient import client as manila_client
|
||||
import os_client_config
|
||||
from oslo_log import log
|
||||
from oslotest import base
|
||||
|
@ -52,6 +53,33 @@ def get_cinder_client_from_env():
|
|||
return client.Client(session=session)
|
||||
|
||||
|
||||
def get_manila_client_from_env():
|
||||
# We should catch KeyError exception with the purpose of
|
||||
# source or configure openrc file.
|
||||
auth_url = os.environ['OS_AUTH_URL']
|
||||
username = os.environ['OS_USERNAME']
|
||||
password = os.environ['OS_PASSWORD']
|
||||
project_name = os.environ['OS_PROJECT_NAME']
|
||||
|
||||
# Either project(user)_domain_name or project(user)_domain_id
|
||||
# would be acceptable.
|
||||
project_domain_name = os.environ.get("OS_PROJECT_DOMAIN_NAME")
|
||||
project_domain_id = os.environ.get("OS_PROJECT_DOMAIN_ID")
|
||||
user_domain_name = os.environ.get("OS_USER_DOMAIN_NAME")
|
||||
user_domain_id = os.environ.get("OS_USER_DOMAIN_ID")
|
||||
|
||||
auth = identity.Password(auth_url=auth_url,
|
||||
username=username,
|
||||
password=password,
|
||||
project_name=project_name,
|
||||
project_domain_id=project_domain_id,
|
||||
project_domain_name=project_domain_name,
|
||||
user_domain_id=user_domain_id,
|
||||
user_domain_name=user_domain_name)
|
||||
session = ks.Session(auth=auth)
|
||||
return manila_client.Client(session=session, client_version='2')
|
||||
|
||||
|
||||
def _get_cloud_config_auth_data(cloud='devstack-admin'):
|
||||
"""Retrieves Keystone auth data to run functional tests
|
||||
|
||||
|
@ -73,6 +101,12 @@ def get_cinder_client_from_creds():
|
|||
return client.Client(session=session, auth=auth_plugin)
|
||||
|
||||
|
||||
def get_manila_client_from_creds():
|
||||
auth_plugin, session = _get_cloud_config_auth_data()
|
||||
return manila_client.Client(session=session, auth=auth_plugin,
|
||||
client_version='2')
|
||||
|
||||
|
||||
class FuxiBaseTest(base.BaseTestCase):
|
||||
"""Basic class for Fuxi fullstack testing
|
||||
|
||||
|
@ -86,6 +120,7 @@ class FuxiBaseTest(base.BaseTestCase):
|
|||
base_url='tcp://0.0.0.0:2375')
|
||||
try:
|
||||
self.cinder_client = get_cinder_client_from_env()
|
||||
self.manila_client = get_manila_client_from_env()
|
||||
except Exception as e:
|
||||
# We may missing or didn't source configured openrc file.
|
||||
message = _LW('Missing environment variable %s in your local. '
|
||||
|
@ -95,3 +130,4 @@ class FuxiBaseTest(base.BaseTestCase):
|
|||
'Trying credentials from DevStack cloud.yaml ...')
|
||||
LOG.warning(message, e.args[0])
|
||||
self.cinder_client = get_cinder_client_from_creds()
|
||||
self.manila_client = get_manila_client_from_creds()
|
||||
|
|
|
@ -67,3 +67,23 @@ class VolumeTest(fuxi_base.FuxiBaseTest):
|
|||
volume_found = True
|
||||
self.assertTrue(volume_found)
|
||||
self.docker_client.remove_volume(vol_name)
|
||||
|
||||
def test_create_delete_volume_with_manila_provider(self):
|
||||
driver_opts = {
|
||||
'volume_provider': 'manila',
|
||||
}
|
||||
vol_name = utils.get_random_string(8)
|
||||
self.docker_client.create_volume(name=vol_name, driver='fuxi',
|
||||
driver_opts=driver_opts)
|
||||
try:
|
||||
volumes = self.manila_client.shares.list(
|
||||
search_opts={'all_tenants': 1, 'name': vol_name})
|
||||
except Exception as e:
|
||||
self.docker_client.remove_volume(vol_name)
|
||||
message = ("Failed to list cinder volumes: %s")
|
||||
self.fail(message % str(e))
|
||||
self.assertEqual(1, len(volumes))
|
||||
self.docker_client.remove_volume(vol_name)
|
||||
volumes = self.manila_client.shares.list(
|
||||
search_opts={'all_tenants': 1, 'name': vol_name})
|
||||
self.assertEqual(0, len(volumes))
|
||||
|
|
Loading…
Reference in New Issue