Update tests to use Juju storage
Due to changes to the ceph-osd charm, it is suggested to use Juju storage for testing. Change-Id: I329a99ea20879224f90384a8f50eecc76f5fb2ad Related-Bug: #1698154
This commit is contained in:
parent
bb4e4912c7
commit
0fe0bcc8d0
@ -223,6 +223,11 @@ def https():
|
|||||||
return True
|
return True
|
||||||
if config_get('ssl_cert') and config_get('ssl_key'):
|
if config_get('ssl_cert') and config_get('ssl_key'):
|
||||||
return True
|
return True
|
||||||
|
for r_id in relation_ids('certificates'):
|
||||||
|
for unit in relation_list(r_id):
|
||||||
|
ca = relation_get('ca', rid=r_id, unit=unit)
|
||||||
|
if ca:
|
||||||
|
return True
|
||||||
for r_id in relation_ids('identity-service'):
|
for r_id in relation_ids('identity-service'):
|
||||||
for unit in relation_list(r_id):
|
for unit in relation_list(r_id):
|
||||||
# TODO - needs fixing for new helper as ssl_cert/key suffixes with CN
|
# TODO - needs fixing for new helper as ssl_cert/key suffixes with CN
|
||||||
|
@ -40,6 +40,7 @@ import novaclient
|
|||||||
import pika
|
import pika
|
||||||
import swiftclient
|
import swiftclient
|
||||||
|
|
||||||
|
from charmhelpers.core.decorators import retry_on_exception
|
||||||
from charmhelpers.contrib.amulet.utils import (
|
from charmhelpers.contrib.amulet.utils import (
|
||||||
AmuletUtils
|
AmuletUtils
|
||||||
)
|
)
|
||||||
@ -423,6 +424,7 @@ class OpenStackAmuletUtils(AmuletUtils):
|
|||||||
self.log.debug('Checking if tenant exists ({})...'.format(tenant))
|
self.log.debug('Checking if tenant exists ({})...'.format(tenant))
|
||||||
return tenant in [t.name for t in keystone.tenants.list()]
|
return tenant in [t.name for t in keystone.tenants.list()]
|
||||||
|
|
||||||
|
@retry_on_exception(num_retries=5, base_delay=1)
|
||||||
def keystone_wait_for_propagation(self, sentry_relation_pairs,
|
def keystone_wait_for_propagation(self, sentry_relation_pairs,
|
||||||
api_version):
|
api_version):
|
||||||
"""Iterate over list of sentry and relation tuples and verify that
|
"""Iterate over list of sentry and relation tuples and verify that
|
||||||
@ -542,7 +544,7 @@ class OpenStackAmuletUtils(AmuletUtils):
|
|||||||
return ep
|
return ep
|
||||||
|
|
||||||
def get_default_keystone_session(self, keystone_sentry,
|
def get_default_keystone_session(self, keystone_sentry,
|
||||||
openstack_release=None):
|
openstack_release=None, api_version=2):
|
||||||
"""Return a keystone session object and client object assuming standard
|
"""Return a keystone session object and client object assuming standard
|
||||||
default settings
|
default settings
|
||||||
|
|
||||||
@ -557,12 +559,12 @@ class OpenStackAmuletUtils(AmuletUtils):
|
|||||||
eyc
|
eyc
|
||||||
"""
|
"""
|
||||||
self.log.debug('Authenticating keystone admin...')
|
self.log.debug('Authenticating keystone admin...')
|
||||||
api_version = 2
|
|
||||||
client_class = keystone_client.Client
|
|
||||||
# 11 => xenial_queens
|
# 11 => xenial_queens
|
||||||
if openstack_release and openstack_release >= 11:
|
if api_version == 3 or (openstack_release and openstack_release >= 11):
|
||||||
api_version = 3
|
|
||||||
client_class = keystone_client_v3.Client
|
client_class = keystone_client_v3.Client
|
||||||
|
api_version = 3
|
||||||
|
else:
|
||||||
|
client_class = keystone_client.Client
|
||||||
keystone_ip = keystone_sentry.info['public-address']
|
keystone_ip = keystone_sentry.info['public-address']
|
||||||
session, auth = self.get_keystone_session(
|
session, auth = self.get_keystone_session(
|
||||||
keystone_ip,
|
keystone_ip,
|
||||||
|
@ -789,6 +789,7 @@ class ApacheSSLContext(OSContextGenerator):
|
|||||||
ssl_dir = os.path.join('/etc/apache2/ssl/', self.service_namespace)
|
ssl_dir = os.path.join('/etc/apache2/ssl/', self.service_namespace)
|
||||||
mkdir(path=ssl_dir)
|
mkdir(path=ssl_dir)
|
||||||
cert, key = get_cert(cn)
|
cert, key = get_cert(cn)
|
||||||
|
if cert and key:
|
||||||
if cn:
|
if cn:
|
||||||
cert_filename = 'cert_{}'.format(cn)
|
cert_filename = 'cert_{}'.format(cn)
|
||||||
key_filename = 'key_{}'.format(cn)
|
key_filename = 'key_{}'.format(cn)
|
||||||
@ -871,13 +872,21 @@ class ApacheSSLContext(OSContextGenerator):
|
|||||||
if not self.external_ports or not https():
|
if not self.external_ports or not https():
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
use_keystone_ca = True
|
||||||
|
for rid in relation_ids('certificates'):
|
||||||
|
if related_units(rid):
|
||||||
|
use_keystone_ca = False
|
||||||
|
|
||||||
|
if use_keystone_ca:
|
||||||
self.configure_ca()
|
self.configure_ca()
|
||||||
|
|
||||||
self.enable_modules()
|
self.enable_modules()
|
||||||
|
|
||||||
ctxt = {'namespace': self.service_namespace,
|
ctxt = {'namespace': self.service_namespace,
|
||||||
'endpoints': [],
|
'endpoints': [],
|
||||||
'ext_ports': []}
|
'ext_ports': []}
|
||||||
|
|
||||||
|
if use_keystone_ca:
|
||||||
cns = self.canonical_names()
|
cns = self.canonical_names()
|
||||||
if cns:
|
if cns:
|
||||||
for cn in cns:
|
for cn in cns:
|
||||||
|
@ -184,3 +184,13 @@ def resolve_address(endpoint_type=PUBLIC, override=True):
|
|||||||
"clustered=%s)" % (net_type, clustered))
|
"clustered=%s)" % (net_type, clustered))
|
||||||
|
|
||||||
return resolved_address
|
return resolved_address
|
||||||
|
|
||||||
|
|
||||||
|
def get_vip_in_network(network):
|
||||||
|
matching_vip = None
|
||||||
|
vips = config('vip')
|
||||||
|
if vips:
|
||||||
|
for vip in vips.split():
|
||||||
|
if is_address_in_network(network, vip):
|
||||||
|
matching_vip = vip
|
||||||
|
return matching_vip
|
||||||
|
@ -972,6 +972,13 @@ def application_version_set(version):
|
|||||||
log("Application Version: {}".format(version))
|
log("Application Version: {}".format(version))
|
||||||
|
|
||||||
|
|
||||||
|
@translate_exc(from_exc=OSError, to_exc=NotImplementedError)
|
||||||
|
def goal_state():
|
||||||
|
"""Juju goal state values"""
|
||||||
|
cmd = ['goal-state', '--format=json']
|
||||||
|
return json.loads(subprocess.check_output(cmd).decode('UTF-8'))
|
||||||
|
|
||||||
|
|
||||||
@translate_exc(from_exc=OSError, to_exc=NotImplementedError)
|
@translate_exc(from_exc=OSError, to_exc=NotImplementedError)
|
||||||
def is_leader():
|
def is_leader():
|
||||||
"""Does the current unit hold the juju leadership
|
"""Does the current unit hold the juju leadership
|
||||||
|
@ -68,7 +68,8 @@ class CinderBackupBasicDeployment(OpenStackAmuletDeployment):
|
|||||||
{'name': 'keystone'},
|
{'name': 'keystone'},
|
||||||
{'name': 'rabbitmq-server'},
|
{'name': 'rabbitmq-server'},
|
||||||
{'name': 'ceph-mon', 'units': 3},
|
{'name': 'ceph-mon', 'units': 3},
|
||||||
{'name': 'ceph-osd', 'units': 3},
|
{'name': 'ceph-osd', 'units': 3,
|
||||||
|
'storage': {'osd-devices': 'cinder,10G'}},
|
||||||
{'name': 'cinder'},
|
{'name': 'cinder'},
|
||||||
{'name': 'cinder-ceph'},
|
{'name': 'cinder-ceph'},
|
||||||
]
|
]
|
||||||
@ -108,16 +109,6 @@ class CinderBackupBasicDeployment(OpenStackAmuletDeployment):
|
|||||||
ceph_config = {
|
ceph_config = {
|
||||||
'monitor-count': '3',
|
'monitor-count': '3',
|
||||||
'auth-supported': 'none',
|
'auth-supported': 'none',
|
||||||
'fsid': '6547bd3e-1397-11e2-82e5-53567c8d32dc',
|
|
||||||
'monitor-secret': 'AQCXrnZQwI7KGBAAiPofmKEXKxu5bUzoYLVkbQ==',
|
|
||||||
}
|
|
||||||
|
|
||||||
# Include a non-existent device as osd-devices is a whitelist,
|
|
||||||
# and this will catch cases where proposals attempt to change that.
|
|
||||||
ceph_osd_config = {
|
|
||||||
'osd-reformat': True,
|
|
||||||
'ephemeral-unmount': '/mnt',
|
|
||||||
'osd-devices': '/dev/vdb /srv/ceph /dev/test-non-existent'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cinder_ceph_config = {
|
cinder_ceph_config = {
|
||||||
@ -128,7 +119,6 @@ class CinderBackupBasicDeployment(OpenStackAmuletDeployment):
|
|||||||
'percona-cluster': pxc_config,
|
'percona-cluster': pxc_config,
|
||||||
'cinder': cinder_config,
|
'cinder': cinder_config,
|
||||||
'ceph-mon': ceph_config,
|
'ceph-mon': ceph_config,
|
||||||
'ceph-osd': ceph_osd_config,
|
|
||||||
'cinder-ceph': cinder_ceph_config,
|
'cinder-ceph': cinder_ceph_config,
|
||||||
'cinder-backup': cinder_ceph_config,
|
'cinder-backup': cinder_ceph_config,
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,8 @@ class AmuletDeployment(object):
|
|||||||
this_service['units'] = 1
|
this_service['units'] = 1
|
||||||
|
|
||||||
self.d.add(this_service['name'], units=this_service['units'],
|
self.d.add(this_service['name'], units=this_service['units'],
|
||||||
constraints=this_service.get('constraints'))
|
constraints=this_service.get('constraints'),
|
||||||
|
storage=this_service.get('storage'))
|
||||||
|
|
||||||
for svc in other_services:
|
for svc in other_services:
|
||||||
if 'location' in svc:
|
if 'location' in svc:
|
||||||
@ -64,7 +65,8 @@ class AmuletDeployment(object):
|
|||||||
svc['units'] = 1
|
svc['units'] = 1
|
||||||
|
|
||||||
self.d.add(svc['name'], charm=branch_location, units=svc['units'],
|
self.d.add(svc['name'], charm=branch_location, units=svc['units'],
|
||||||
constraints=svc.get('constraints'))
|
constraints=svc.get('constraints'),
|
||||||
|
storage=svc.get('storage'))
|
||||||
|
|
||||||
def _add_relations(self, relations):
|
def _add_relations(self, relations):
|
||||||
"""Add all of the relations for the services."""
|
"""Add all of the relations for the services."""
|
||||||
|
@ -40,6 +40,7 @@ import novaclient
|
|||||||
import pika
|
import pika
|
||||||
import swiftclient
|
import swiftclient
|
||||||
|
|
||||||
|
from charmhelpers.core.decorators import retry_on_exception
|
||||||
from charmhelpers.contrib.amulet.utils import (
|
from charmhelpers.contrib.amulet.utils import (
|
||||||
AmuletUtils
|
AmuletUtils
|
||||||
)
|
)
|
||||||
@ -423,6 +424,7 @@ class OpenStackAmuletUtils(AmuletUtils):
|
|||||||
self.log.debug('Checking if tenant exists ({})...'.format(tenant))
|
self.log.debug('Checking if tenant exists ({})...'.format(tenant))
|
||||||
return tenant in [t.name for t in keystone.tenants.list()]
|
return tenant in [t.name for t in keystone.tenants.list()]
|
||||||
|
|
||||||
|
@retry_on_exception(num_retries=5, base_delay=1)
|
||||||
def keystone_wait_for_propagation(self, sentry_relation_pairs,
|
def keystone_wait_for_propagation(self, sentry_relation_pairs,
|
||||||
api_version):
|
api_version):
|
||||||
"""Iterate over list of sentry and relation tuples and verify that
|
"""Iterate over list of sentry and relation tuples and verify that
|
||||||
@ -542,7 +544,7 @@ class OpenStackAmuletUtils(AmuletUtils):
|
|||||||
return ep
|
return ep
|
||||||
|
|
||||||
def get_default_keystone_session(self, keystone_sentry,
|
def get_default_keystone_session(self, keystone_sentry,
|
||||||
openstack_release=None):
|
openstack_release=None, api_version=2):
|
||||||
"""Return a keystone session object and client object assuming standard
|
"""Return a keystone session object and client object assuming standard
|
||||||
default settings
|
default settings
|
||||||
|
|
||||||
@ -557,12 +559,12 @@ class OpenStackAmuletUtils(AmuletUtils):
|
|||||||
eyc
|
eyc
|
||||||
"""
|
"""
|
||||||
self.log.debug('Authenticating keystone admin...')
|
self.log.debug('Authenticating keystone admin...')
|
||||||
api_version = 2
|
|
||||||
client_class = keystone_client.Client
|
|
||||||
# 11 => xenial_queens
|
# 11 => xenial_queens
|
||||||
if openstack_release and openstack_release >= 11:
|
if api_version == 3 or (openstack_release and openstack_release >= 11):
|
||||||
api_version = 3
|
|
||||||
client_class = keystone_client_v3.Client
|
client_class = keystone_client_v3.Client
|
||||||
|
api_version = 3
|
||||||
|
else:
|
||||||
|
client_class = keystone_client.Client
|
||||||
keystone_ip = keystone_sentry.info['public-address']
|
keystone_ip = keystone_sentry.info['public-address']
|
||||||
session, auth = self.get_keystone_session(
|
session, auth = self.get_keystone_session(
|
||||||
keystone_ip,
|
keystone_ip,
|
||||||
|
@ -972,6 +972,13 @@ def application_version_set(version):
|
|||||||
log("Application Version: {}".format(version))
|
log("Application Version: {}".format(version))
|
||||||
|
|
||||||
|
|
||||||
|
@translate_exc(from_exc=OSError, to_exc=NotImplementedError)
|
||||||
|
def goal_state():
|
||||||
|
"""Juju goal state values"""
|
||||||
|
cmd = ['goal-state', '--format=json']
|
||||||
|
return json.loads(subprocess.check_output(cmd).decode('UTF-8'))
|
||||||
|
|
||||||
|
|
||||||
@translate_exc(from_exc=OSError, to_exc=NotImplementedError)
|
@translate_exc(from_exc=OSError, to_exc=NotImplementedError)
|
||||||
def is_leader():
|
def is_leader():
|
||||||
"""Does the current unit hold the juju leadership
|
"""Does the current unit hold the juju leadership
|
||||||
|
Loading…
Reference in New Issue
Block a user