diff --git a/charmhelpers/contrib/openstack/utils.py b/charmhelpers/contrib/openstack/utils.py index d5d301e..9cc96d6 100644 --- a/charmhelpers/contrib/openstack/utils.py +++ b/charmhelpers/contrib/openstack/utils.py @@ -1413,7 +1413,8 @@ def incomplete_relation_data(configs, required_interfaces): for i in incomplete_relations} -def do_action_openstack_upgrade(package, upgrade_callback, configs): +def do_action_openstack_upgrade(package, upgrade_callback, configs, + force_upgrade=False): """Perform action-managed OpenStack upgrade. Upgrades packages to the configured openstack-origin version and sets @@ -1427,12 +1428,13 @@ def do_action_openstack_upgrade(package, upgrade_callback, configs): @param package: package name for determining if upgrade available @param upgrade_callback: function callback to charm's upgrade function @param configs: templating object derived from OSConfigRenderer class + @param force_upgrade: perform dist-upgrade regardless of new openstack @return: True if upgrade successful; False if upgrade failed or skipped """ ret = False - if openstack_upgrade_available(package): + if openstack_upgrade_available(package) or force_upgrade: if config('action-managed-upgrade'): juju_log('Upgrading OpenStack release') @@ -2599,6 +2601,23 @@ def get_subordinate_release_packages(os_release, package_type='deb'): return SubordinatePackages(install, purge) +def get_subordinate_services(): + """Iterate over subordinate relations and get service information. + + In a similar fashion as with get_subordinate_release_packages(), + principle charms can retrieve a list of services advertised by their + subordinate charms. This is useful to know about subordinate services when + pausing, resuming or upgrading a principle unit. + + :returns: Name of all services advertised by all subordinates + :rtype: Set[str] + """ + services = set() + for rdata in container_scoped_relation_get('services'): + services |= set(json.loads(rdata or '[]')) + return services + + os_restart_on_change = partial( pausable_restart_on_change, can_restart_now_f=deferred_events.check_and_record_restart_request, diff --git a/charmhelpers/contrib/storage/linux/ceph.py b/charmhelpers/contrib/storage/linux/ceph.py index 3eb46d7..c70aeb2 100644 --- a/charmhelpers/contrib/storage/linux/ceph.py +++ b/charmhelpers/contrib/storage/linux/ceph.py @@ -294,7 +294,6 @@ class BasePool(object): # NOTE: Do not perform initialization steps that require live data from # a running cluster here. The *Pool classes may be used for validation. self.service = service - self.nautilus_or_later = cmp_pkgrevno('ceph-common', '14.2.0') >= 0 self.op = op or {} if op: @@ -341,7 +340,8 @@ class BasePool(object): Do not add calls for a specific pool type here, those should go into one of the pool specific classes. """ - if self.nautilus_or_later: + nautilus_or_later = cmp_pkgrevno('ceph-common', '14.2.0') >= 0 + if nautilus_or_later: # Ensure we set the expected pool ratio update_pool( client=self.service, @@ -660,8 +660,9 @@ class ReplicatedPool(BasePool): else: self.pg_num = self.get_pgs(self.replicas, self.percent_data) + nautilus_or_later = cmp_pkgrevno('ceph-common', '14.2.0') >= 0 # Create it - if self.nautilus_or_later: + if nautilus_or_later: cmd = [ 'ceph', '--id', self.service, 'osd', 'pool', 'create', '--pg-num-min={}'.format( @@ -745,9 +746,9 @@ class ErasurePool(BasePool): k = int(erasure_profile['k']) m = int(erasure_profile['m']) pgs = self.get_pgs(k + m, self.percent_data) - self.nautilus_or_later = cmp_pkgrevno('ceph-common', '14.2.0') >= 0 + nautilus_or_later = cmp_pkgrevno('ceph-common', '14.2.0') >= 0 # Create it - if self.nautilus_or_later: + if nautilus_or_later: cmd = [ 'ceph', '--id', self.service, 'osd', 'pool', 'create', '--pg-num-min={}'.format( diff --git a/charmhelpers/core/host_factory/ubuntu.py b/charmhelpers/core/host_factory/ubuntu.py index e710c0e..0906c5c 100644 --- a/charmhelpers/core/host_factory/ubuntu.py +++ b/charmhelpers/core/host_factory/ubuntu.py @@ -29,6 +29,7 @@ UBUNTU_RELEASES = ( 'groovy', 'hirsute', 'impish', + 'jammy', ) diff --git a/charmhelpers/fetch/ubuntu.py b/charmhelpers/fetch/ubuntu.py index 6c7cf6f..cf8328f 100644 --- a/charmhelpers/fetch/ubuntu.py +++ b/charmhelpers/fetch/ubuntu.py @@ -275,6 +275,7 @@ UBUNTU_OPENSTACK_RELEASE = OrderedDict([ ('groovy', 'victoria'), ('hirsute', 'wallaby'), ('impish', 'xena'), + ('jammy', 'yoga'), ]) diff --git a/metadata.yaml b/metadata.yaml index 63e82ae..af27646 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -13,6 +13,7 @@ series: - groovy - hirsute - impish +- jammy requires: juju-info: interface: juju-info diff --git a/osci.yaml b/osci.yaml index 4e322d5..a07bfdb 100644 --- a/osci.yaml +++ b/osci.yaml @@ -4,7 +4,10 @@ - charm-functional-jobs check: jobs: - - focal-xena: + - focal-xena + - focal-yoga: voting: false - impish-xena: voting: false + - jammy-yoga: + voting: false diff --git a/test-requirements.txt b/test-requirements.txt index 55e2b7a..a6e51e2 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -7,6 +7,8 @@ # requirements. They are intertwined. Also, Zaza itself should specify # all of its own requirements and if it doesn't, fix it there. # +pyparsing<3.0.0 # aodhclient is pinned in zaza and needs pyparsing < 3.0.0, but cffi also needs it, so pin here. +cffi==1.14.6; python_version < '3.6' # cffi 1.15.0 drops support for py35. setuptools<50.0.0 # https://github.com/pypa/setuptools/commit/04e3df22df840c6bb244e9b27bc56750c44b7c85 requests>=2.18.4 diff --git a/tests/bundles/focal-yoga.yaml b/tests/bundles/focal-yoga.yaml new file mode 100644 index 0000000..8e48eba --- /dev/null +++ b/tests/bundles/focal-yoga.yaml @@ -0,0 +1,54 @@ +variables: + openstack-origin: &openstack-origin cloud:focal-yoga + +series: focal + +machines: + '0': + constraints: mem=3072M + '1': + constraints: mem=3072M + '2': + constraints: mem=3072M + '3': + '4': + '5': + +applications: + + keystone-mysql-router: + charm: cs:~openstack-charmers-next/mysql-router + + mysql-innodb-cluster: + charm: cs:~openstack-charmers-next/mysql-innodb-cluster + num_units: 3 + options: + source: *openstack-origin + to: + - '0' + - '1' + - '2' + + keystone: + charm: cs:~openstack-charmers-next/keystone + num_units: 3 + options: + token-expiration: 60 + openstack-origin: *openstack-origin + to: + - '3' + - '4' + - '5' + + hacluster: + charm: ../../../hacluster + subordinate-to: + - keystone + +relations: + - - 'keystone:shared-db' + - 'keystone-mysql-router:shared-db' + - - 'hacluster:ha' + - 'keystone:ha' + - - "keystone-mysql-router:db-router" + - "mysql-innodb-cluster:db-router" diff --git a/tests/bundles/groovy-victoria.yaml b/tests/bundles/jammy-yoga.yaml similarity index 98% rename from tests/bundles/groovy-victoria.yaml rename to tests/bundles/jammy-yoga.yaml index fa9ffc4..4b8545b 100644 --- a/tests/bundles/groovy-victoria.yaml +++ b/tests/bundles/jammy-yoga.yaml @@ -1,7 +1,7 @@ variables: openstack-origin: &openstack-origin distro -series: groovy +series: jammy machines: '0': diff --git a/tests/tests.yaml b/tests/tests.yaml index fe7f640..bb7bbfb 100644 --- a/tests/tests.yaml +++ b/tests/tests.yaml @@ -4,25 +4,26 @@ smoke_bundles: - focal-ussuri gate_bundles: - - xenial-mitaka - bionic-queens - bionic-stein - - bionic-train - bionic-ussuri - focal-ussuri - focal-victoria - focal-wallaby + - focal-xena - hirsute-wallaby + - impish-xena dev_bundles: - trusty-mitaka + - xenial-mitaka - xenial-ocata - xenial-pike - xenial-queens - bionic-rocky - - groovy-victoria - - focal-xena - - impish-xena + - bionic-train + - focal-yoga + - jammy-yoga configure: - zaza.openstack.charm_tests.keystone.setup.add_demo_user @@ -36,5 +37,6 @@ tests_options: principle-app-name: keystone hacluster-charm-name: hacluster force_deploy: - - groovy-victoria + - hirsute-wallaby - impish-xena + - jammy-yoga