diff --git a/charmhelpers/contrib/openstack/ip.py b/charmhelpers/contrib/openstack/ip.py index 723aebc..89cf276 100644 --- a/charmhelpers/contrib/openstack/ip.py +++ b/charmhelpers/contrib/openstack/ip.py @@ -33,6 +33,7 @@ INTERNAL = 'int' ADMIN = 'admin' ACCESS = 'access' +# TODO: reconcile 'int' vs 'internal' binding names ADDRESS_MAP = { PUBLIC: { 'binding': 'public', @@ -58,6 +59,14 @@ ADDRESS_MAP = { 'fallback': 'private-address', 'override': 'os-access-hostname', }, + # Note (thedac) bridge to begin the reconciliation between 'int' vs + # 'internal' binding names + 'internal': { + 'binding': 'internal', + 'config': 'os-internal-network', + 'fallback': 'private-address', + 'override': 'os-internal-hostname', + }, } @@ -195,3 +204,10 @@ def get_vip_in_network(network): if is_address_in_network(network, vip): matching_vip = vip return matching_vip + + +def get_default_api_bindings(): + _default_bindings = [] + for binding in [INTERNAL, ADMIN, PUBLIC]: + _default_bindings.append(ADDRESS_MAP[binding]['binding']) + return _default_bindings diff --git a/charmhelpers/contrib/openstack/utils.py b/charmhelpers/contrib/openstack/utils.py index 0aa797c..23e4adf 100644 --- a/charmhelpers/contrib/openstack/utils.py +++ b/charmhelpers/contrib/openstack/utils.py @@ -230,7 +230,7 @@ SWIFT_CODENAMES = OrderedDict([ ('ussuri', ['2.24.0', '2.25.0']), ('victoria', - ['2.25.0']), + ['2.25.0', '2.26.0']), ]) # >= Liberty version->codename mapping diff --git a/charmhelpers/contrib/storage/linux/ceph.py b/charmhelpers/contrib/storage/linux/ceph.py index 526b95a..0f69631 100644 --- a/charmhelpers/contrib/storage/linux/ceph.py +++ b/charmhelpers/contrib/storage/linux/ceph.py @@ -41,6 +41,7 @@ from subprocess import ( ) from charmhelpers import deprecate from charmhelpers.core.hookenv import ( + application_name, config, service_name, local_unit, @@ -162,6 +163,17 @@ def get_osd_settings(relation_name): return _order_dict_by_key(osd_settings) +def send_application_name(relid=None): + """Send the application name down the relation. + + :param relid: Relation id to set application name in. + :type relid: str + """ + relation_set( + relation_id=relid, + relation_settings={'application-name': application_name()}) + + def send_osd_settings(): """Pass on requested OSD settings to osd units.""" try: @@ -1074,7 +1086,10 @@ def create_erasure_profile(service, profile_name, erasure_plugin_technique=None): """Create a new erasure code profile if one does not already exist for it. - Updates the profile if it exists. Please refer to [0] for more details. + Profiles are considered immutable so will not be updated if the named + profile already exists. + + Please refer to [0] for more details. 0: http://docs.ceph.com/docs/master/rados/operations/erasure-code-profile/ @@ -1110,6 +1125,11 @@ def create_erasure_profile(service, profile_name, :type erasure_plugin_technique: str :return: None. Can raise CalledProcessError, ValueError or AssertionError """ + if erasure_profile_exists(service, profile_name): + log('EC profile {} exists, skipping update'.format(profile_name), + level=WARNING) + return + plugin_techniques = { 'jerasure': [ 'reed_sol_van', @@ -1209,9 +1229,6 @@ def create_erasure_profile(service, profile_name, if scalar_mds: cmd.append('scalar-mds={}'.format(scalar_mds)) - if erasure_profile_exists(service, profile_name): - cmd.append('--force') - check_call(cmd) @@ -2198,6 +2215,7 @@ def send_request_if_needed(request, relation='ceph'): for rid in relation_ids(relation): log('Sending request {}'.format(request.request_id), level=DEBUG) relation_set(relation_id=rid, broker_req=request.request) + relation_set(relation_id=rid, relation_settings={'unit-name': local_unit()}) def has_broker_rsp(rid=None, unit=None): diff --git a/hooks/hooks.py b/hooks/hooks.py index f0e8866..8df9ced 100755 --- a/hooks/hooks.py +++ b/hooks/hooks.py @@ -126,7 +126,6 @@ from charmhelpers.contrib.charmsupport import nrpe hooks = Hooks() -PACKAGES = ['corosync', 'pacemaker', 'python-netaddr', 'ipmitool'] COROSYNC_CONF = '/etc/corosync/corosync.conf' COROSYNC_DEFAULT = '/etc/default/corosync' COROSYNC_AUTHKEY = '/etc/corosync/authkey' @@ -137,7 +136,7 @@ COROSYNC_CONF_FILES = [ COROSYNC_CONF ] -PACKAGES = ['crmsh', 'corosync', 'pacemaker', 'python-netaddr', 'ipmitool', +PACKAGES = ['crmsh', 'corosync', 'pacemaker', 'python3-netaddr', 'ipmitool', 'libmonitoring-plugin-perl', 'python3-requests-oauthlib'] SUPPORTED_TRANSPORTS = ['udp', 'udpu', 'multicast', 'unicast'] @@ -148,12 +147,17 @@ DEPRECATED_TRANSPORT_VALUES = {"multicast": "udp", "unicast": "udpu"} def install(): pkgs = copy.deepcopy(PACKAGES) ubuntu_release = lsb_release()['DISTRIB_CODENAME'].lower() - # use libnagios on anything older than Xenial if CompareHostReleases(ubuntu_release) < 'xenial': + # use libnagios on anything older than Xenial pkgs.remove('libmonitoring-plugin-perl') pkgs.append('libnagios-plugin-perl') + + pkgs.remove('python3-netaddr') + pkgs.append('python-netaddr') + elif CompareHostReleases(ubuntu_release) >= 'bionic': pkgs.append('python3-libmaas') + # NOTE(dosaboy): we currently disallow upgrades due to bug #1382842. This # should be removed once the pacemaker package is fixed. status_set('maintenance', 'Installing apt packages') diff --git a/tests/tests.yaml b/tests/tests.yaml index 558bfc6..2234246 100644 --- a/tests/tests.yaml +++ b/tests/tests.yaml @@ -15,7 +15,6 @@ gate_bundles: - bionic-ussuri - focal-ussuri - focal-victoria -dev_bundles: - groovy-victoria configure: diff --git a/unit_tests/test_hacluster_hooks.py b/unit_tests/test_hacluster_hooks.py index 443dceb..6cf838b 100644 --- a/unit_tests/test_hacluster_hooks.py +++ b/unit_tests/test_hacluster_hooks.py @@ -327,7 +327,7 @@ class TestHooks(test_utils.CharmTestCase): 'DISTRIB_CODENAME': 'xenial'} filter_installed_packages.side_effect = lambda x: x expected_pkgs = [ - 'crmsh', 'corosync', 'pacemaker', 'python-netaddr', 'ipmitool', + 'crmsh', 'corosync', 'pacemaker', 'python3-netaddr', 'ipmitool', 'libmonitoring-plugin-perl', 'python3-requests-oauthlib'] hooks.install() status_set.assert_called_once_with( @@ -348,7 +348,7 @@ class TestHooks(test_utils.CharmTestCase): 'DISTRIB_CODENAME': 'bionic'} filter_installed_packages.side_effect = lambda x: x expected_pkgs = [ - 'crmsh', 'corosync', 'pacemaker', 'python-netaddr', 'ipmitool', + 'crmsh', 'corosync', 'pacemaker', 'python3-netaddr', 'ipmitool', 'libmonitoring-plugin-perl', 'python3-requests-oauthlib', 'python3-libmaas'] hooks.install()