From caa7f5f3fbaa6d2a75a737e04906d017fa241810 Mon Sep 17 00:00:00 2001 From: Luciano Lo Giudice Date: Wed, 29 May 2024 14:02:17 -0300 Subject: [PATCH 1/5] CI migration (octopus) --- .github/workflows/build-and-test.yml | 104 +++++++++ .github/workflows/pr.yaml | 8 + src/test-requirements.txt | 4 +- src/tests/bundles/bionic-ussuri.yaml | 142 ------------ src/tests/target.py | 319 +++++++++++++++++++++++++++ src/tests/tests.yaml | 42 ++-- src/tox.ini | 1 + tox.ini | 17 +- 8 files changed, 458 insertions(+), 179 deletions(-) create mode 100644 .github/workflows/build-and-test.yml create mode 100644 .github/workflows/pr.yaml delete mode 100644 src/tests/bundles/bionic-ussuri.yaml create mode 100644 src/tests/target.py diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..78da1eb --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,104 @@ +name: Build/Test + +on: + workflow_call: + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install dependencies + run: python3 -m pip install tox + + - name: Run linters + run: tox -e pep8 + + unit-test: + name: Unit tests + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get -qq install libxslt-dev libxml2-dev python3-lxml + python3 -m pip install tox + + - name: Run tests + run: tox -e py3 + + build: + name: Build the charm + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Setup LXD + uses: canonical/setup-lxd@v0.1.1 + with: + channel: 5.20/stable + + - name: Install dependencies + run: python3 -m pip install tox + + - name: Build charm(s) + id: builder + run: | + sudo snap install charmcraft --classic + tox -e build + + - name: Upload built charm + uses: actions/upload-artifact@v3 + with: + name: charms + path: "*.charm" + + functional-test: + needs: + - lint + - unit-test + - build + name: Functional tests + runs-on: self-hosted + steps: + + - name: Download charm + uses: actions/download-artifact@v3 + with: + name: charms + path: ~/artifacts/ + + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup LXD + uses: canonical/setup-lxd@v0.1.1 + with: + # pin lxd to LTS release. + channel: 5.21/stable + + - name: Install dependencies + run: | + python3 -m pip install tox + if [ ! -d "$HOME/.local/share/juju" ]; then + sudo snap install juju + mkdir -p ~/.local/share/juju + juju bootstrap localhost localhost + fi + + - name: Run focal-ussuri tests + run: | + date + mv ~/artifacts/ceph-fs.charm ./ + tox -c src -e func-target -- focal-ussuri diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml new file mode 100644 index 0000000..6e045d5 --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,8 @@ +name: PR + +on: + pull_request: + +jobs: + build: + uses: ./.github/workflows/build-and-test.yml diff --git a/src/test-requirements.txt b/src/test-requirements.txt index c0f321a..9c7afb7 100644 --- a/src/test-requirements.txt +++ b/src/test-requirements.txt @@ -8,5 +8,5 @@ tox # Functional Test Requirements (let Zaza's dependencies solve all dependencies here!) -git+https://github.com/openstack-charmers/zaza.git@stable/ussuri#egg=zaza -git+https://github.com/openstack-charmers/zaza-openstack-tests.git@stable/ussuri#egg=zaza.openstack +git+https://github.com/openstack-charmers/zaza.git#egg=zaza +git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack diff --git a/src/tests/bundles/bionic-ussuri.yaml b/src/tests/bundles/bionic-ussuri.yaml deleted file mode 100644 index cb9864e..0000000 --- a/src/tests/bundles/bionic-ussuri.yaml +++ /dev/null @@ -1,142 +0,0 @@ -series: bionic -applications: - ceph-fs: - charm: ../../../ceph-fs.charm - num_units: 1 - options: - source: cloud:bionic-ussuri - pool-type: erasure-coded - ec-profile-k: 4 - ec-profile-m: 2 - ceph-osd: - charm: ch:ceph-osd - num_units: 6 - storage: - osd-devices: 'cinder,10G' - options: - osd-devices: '/dev/test-non-existent' - source: cloud:bionic-ussuri - ceph-mon: - charm: ch:ceph-mon - num_units: 3 - options: - monitor-count: '3' - source: cloud:bionic-ussuri - percona-cluster: - charm: ch:percona-cluster - num_units: 1 - options: - dataset-size: 25% - max-connections: 1000 - source: cloud:bionic-ussuri - rabbitmq-server: - charm: ch:rabbitmq-server - num_units: 1 - options: - source: cloud:bionic-ussuri - keystone: - expose: True - charm: ch:keystone - num_units: 1 - options: - openstack-origin: cloud:bionic-ussuri - glance: - expose: True - charm: ch:glance - num_units: 1 - options: - openstack-origin: cloud:bionic-ussuri - nova-cloud-controller: - expose: True - charm: ch:nova-cloud-controller - num_units: 1 - options: - network-manager: Neutron - openstack-origin: cloud:bionic-ussuri - nova-compute: - charm: ch:nova-compute - num_units: 2 - constraints: mem=8G - options: - config-flags: default_ephemeral_format=ext4 - enable-live-migration: true - enable-resize: true - migration-auth-type: ssh - openstack-origin: cloud:bionic-ussuri - placement: - charm: ch:placement - num_units: 1 - options: - openstack-origin: cloud:bionic-ussuri - neutron-api: - charm: ch:neutron-api - num_units: 1 - options: - manage-neutron-plugin-legacy-mode: true - neutron-plugin: ovs - flat-network-providers: physnet1 - neutron-security-groups: true - openstack-origin: cloud:bionic-ussuri - neutron-openvswitch: - charm: ch:neutron-openvswitch - neutron-gateway: - charm: ch:neutron-gateway - num_units: 1 - options: - bridge-mappings: physnet1:br-ex - openstack-origin: cloud:bionic-ussuri -relations: -- - 'ceph-mon:mds' - - 'ceph-fs:ceph-mds' -- - 'nova-compute:amqp' - - 'rabbitmq-server:amqp' -- - 'nova-compute:image-service' - - 'glance:image-service' -- - 'nova-compute:ceph' - - 'ceph-mon:client' -- - 'keystone:shared-db' - - 'percona-cluster:shared-db' -- - 'glance:shared-db' - - 'percona-cluster:shared-db' -- - 'glance:identity-service' - - 'keystone:identity-service' -- - 'glance:amqp' - - 'rabbitmq-server:amqp' -- - 'glance:ceph' - - 'ceph-mon:client' -- - 'ceph-osd:mon' - - 'ceph-mon:osd' -- - 'nova-cloud-controller:shared-db' - - 'percona-cluster:shared-db' -- - 'nova-cloud-controller:identity-service' - - 'keystone:identity-service' -- - 'nova-cloud-controller:amqp' - - 'rabbitmq-server:amqp' -- - 'nova-cloud-controller:cloud-compute' - - 'nova-compute:cloud-compute' -- - 'nova-cloud-controller:image-service' - - 'glance:image-service' -- - 'placement' - - 'percona-cluster' -- - 'placement' - - 'keystone' -- - 'placement' - - 'nova-cloud-controller' -- - 'neutron-api:shared-db' - - 'percona-cluster:shared-db' -- - 'neutron-api:amqp' - - 'rabbitmq-server:amqp' -- - 'neutron-api:neutron-api' - - 'nova-cloud-controller:neutron-api' -- - 'neutron-api:neutron-plugin-api' - - 'neutron-gateway:neutron-plugin-api' -- - 'neutron-api:identity-service' - - 'keystone:identity-service' -- - 'nova-compute:neutron-plugin' - - 'neutron-openvswitch:neutron-plugin' -- - 'neutron-gateway:amqp' - - 'rabbitmq-server:amqp' -- - 'neutron-openvswitch:amqp' - - 'rabbitmq-server:amqp' -- - 'nova-cloud-controller:quantum-network-service' - - 'neutron-gateway:quantum-network-service' diff --git a/src/tests/target.py b/src/tests/target.py new file mode 100644 index 0000000..c0bcbae --- /dev/null +++ b/src/tests/target.py @@ -0,0 +1,319 @@ +# Copyright 2024 Canonical Ltd. +# +# 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. + +"""Encapsulate CephFS testing.""" + +import logging +import subprocess +import tenacity +from tenacity import retry, Retrying, stop_after_attempt, wait_exponential +import unittest +import zaza +import zaza.model as model +import zaza.openstack.charm_tests.test_utils as test_utils +import zaza.openstack.utilities.ceph as zaza_ceph +import zaza.openstack.utilities.openstack as openstack_utils + + +class CephFSTests(unittest.TestCase): + """Encapsulate CephFS tests.""" + + mounts_share = False + mount_dir = '/mnt/cephfs' + CEPH_MON = 'ceph-mon' + + def tearDown(self): + """Cleanup after running tests.""" + if self.mounts_share: + for unit in ['ubuntu/0', 'ubuntu/1']: + try: + zaza.utilities.generic.run_via_ssh( + unit_name=unit, + cmd='sudo fusermount -u {0} && sudo rmdir {0}'.format( + self.mount_dir)) + except subprocess.CalledProcessError: + logging.warning( + "Failed to cleanup mounts on {}".format(unit)) + + def _mount_share(self, unit_name: str, + retry: bool = True): + self._install_dependencies(unit_name) + self._install_keyring(unit_name) + ssh_cmd = ( + 'sudo mkdir -p {0} && ' + 'sudo ceph-fuse {0}'.format(self.mount_dir) + ) + if retry: + for attempt in Retrying( + stop=stop_after_attempt(5), + wait=wait_exponential(multiplier=3, + min=2, max=10)): + with attempt: + zaza.utilities.generic.run_via_ssh( + unit_name=unit_name, + cmd=ssh_cmd) + else: + zaza.utilities.generic.run_via_ssh( + unit_name=unit_name, + cmd=ssh_cmd) + self.mounts_share = True + + def _install_keyring(self, unit_name: str): + + keyring = model.run_on_leader( + self.CEPH_MON, 'cat /etc/ceph/ceph.client.admin.keyring')['Stdout'] + config = model.run_on_leader( + self.CEPH_MON, 'cat /etc/ceph/ceph.conf')['Stdout'] + commands = [ + 'sudo mkdir -p /etc/ceph', + "echo '{}' | sudo tee /etc/ceph/ceph.conf".format(config), + "echo '{}' | " + 'sudo tee /etc/ceph/ceph.client.admin.keyring'.format(keyring) + ] + for cmd in commands: + zaza.utilities.generic.run_via_ssh( + unit_name=unit_name, + cmd=cmd) + + def _install_dependencies(self, unit: str): + zaza.utilities.generic.run_via_ssh( + unit_name=unit, + cmd='sudo apt-get install -yq ceph-fuse') + + @classmethod + def setUpClass(cls): + """Run class setup for running tests.""" + super(CephFSTests, cls).setUpClass() + + @retry( + stop=stop_after_attempt(5), + wait=wait_exponential(multiplier=3, min=2, max=10)) + def _write_testing_file_on_instance(self, instance_name: str): + zaza.utilities.generic.run_via_ssh( + unit_name=instance_name, + cmd='echo -n "test" | sudo tee {}/test'.format(self.mount_dir)) + + @retry( + stop=stop_after_attempt(5), + wait=wait_exponential(multiplier=3, min=2, max=10)) + def _verify_testing_file_on_instance(self, instance_name: str): + output = zaza.model.run_on_unit( + instance_name, 'sudo cat {}/test'.format(self.mount_dir))['Stdout'] + self.assertEqual('test', output.strip()) + + def test_cephfs_share(self): + """Test that CephFS shares can be accessed on two instances. + + 1. Spawn two servers + 2. mount it on both + 3. write a file on one + 4. read it on the other + 5. profit + """ + self._mount_share('ubuntu/0') + self._mount_share('ubuntu/1') + + self._write_testing_file_on_instance('ubuntu/0') + self._verify_testing_file_on_instance('ubuntu/1') + + +class CharmOperationTest(test_utils.BaseCharmTest): + """CephFS Charm operation tests.""" + + def test_pause_resume(self): + """Run pause and resume tests. + + Pause service and check services are stopped, then resume and check + they are started. + """ + services = ['ceph-mds'] + with self.pause_resume(services): + logging.info('Testing pause resume (services="{}")' + .format(services)) + + +class BlueStoreCompressionCharmOperation(test_utils.BaseCharmTest): + """Test charm handling of bluestore compression configuration options.""" + + @classmethod + def setUpClass(cls): + """Perform class one time initialization.""" + super(BlueStoreCompressionCharmOperation, cls).setUpClass() + release_application = 'keystone' + try: + model.get_application(release_application) + except KeyError: + release_application = 'ceph-mon' + cls.current_release = openstack_utils.get_os_release( + application=release_application) + cls.bionic_rocky = openstack_utils.get_os_release('bionic_rocky') + + def setUp(self): + """Perform common per test initialization steps.""" + super(BlueStoreCompressionCharmOperation, self).setUp() + + # determine if the tests should be run or not + logging.debug('os_release: {} >= {} = {}' + .format(self.current_release, + self.bionic_rocky, + self.current_release >= self.bionic_rocky)) + self.mimic_or_newer = self.current_release >= self.bionic_rocky + + def _assert_pools_properties(self, pools, pools_detail, + expected_properties, log_func=logging.info): + """Check properties on a set of pools. + + :param pools: List of pool names to check. + :type pools: List[str] + :param pools_detail: List of dictionaries with pool detail + :type pools_detail List[Dict[str,any]] + :param expected_properties: Properties to check and their expected + values. + :type expected_properties: Dict[str,any] + :returns: Nothing + :raises: AssertionError + """ + for pool in pools: + for pd in pools_detail: + if pd['pool_name'] == pool: + if 'options' in expected_properties: + for k, v in expected_properties['options'].items(): + self.assertEquals(pd['options'][k], v) + log_func("['options']['{}'] == {}".format(k, v)) + for k, v in expected_properties.items(): + if k == 'options': + continue + self.assertEquals(pd[k], v) + log_func("{} == {}".format(k, v)) + + def test_configure_compression(self): + """Enable compression and validate properties flush through to pool.""" + if not self.mimic_or_newer: + logging.info('Skipping test, Mimic or newer required.') + return + if self.application_name == 'ceph-osd': + # The ceph-osd charm itself does not request pools, neither does + # the BlueStore Compression configuration options it have affect + # pool properties. + logging.info('test does not apply to ceph-osd charm.') + return + elif self.application_name == 'ceph-radosgw': + # The Ceph RadosGW creates many light weight pools to keep track of + # metadata, we only compress the pool containing actual data. + app_pools = ['.rgw.buckets.data'] + else: + # Retrieve which pools the charm under test has requested skipping + # metadata pools as they are deliberately not compressed. + app_pools = [ + pool + for pool in zaza_ceph.get_pools_from_broker_req( + self.application_name, model_name=self.model_name) + if 'metadata' not in pool + ] + + ceph_pools_detail = zaza_ceph.get_ceph_pool_details( + model_name=self.model_name) + + logging.debug('BEFORE: {}'.format(ceph_pools_detail)) + try: + logging.info('Checking Ceph pool compression_mode prior to change') + self._assert_pools_properties( + app_pools, ceph_pools_detail, + {'options': {'compression_mode': 'none'}}) + except KeyError: + logging.info('property does not exist on pool, which is OK.') + logging.info('Changing "bluestore-compression-mode" to "force" on {}' + .format(self.application_name)) + with self.config_change( + {'bluestore-compression-mode': 'none'}, + {'bluestore-compression-mode': 'force'}): + logging.info('Checking Ceph pool compression_mode after to change') + self._check_pool_compression_mode(app_pools, 'force') + + logging.info('Checking Ceph pool compression_mode after ' + 'restoring config to previous value') + self._check_pool_compression_mode(app_pools, 'none') + + @tenacity.retry( + wait=tenacity.wait_exponential(multiplier=1, min=2, max=10), + stop=tenacity.stop_after_attempt(10), + reraise=True, + retry=tenacity.retry_if_exception_type(AssertionError) + ) + def _check_pool_compression_mode(self, app_pools, mode): + ceph_pools_detail = zaza_ceph.get_ceph_pool_details( + model_name=self.model_name) + logging.debug('ceph_pools_details: %s', ceph_pools_detail) + self._assert_pools_properties( + app_pools, ceph_pools_detail, + {'options': {'compression_mode': mode}}) + + def test_invalid_compression_configuration(self): + """Set invalid configuration and validate charm response.""" + if not self.mimic_or_newer: + logging.info('Skipping test, Mimic or newer required.') + return + stored_target_deploy_status = self.test_config.get( + 'target_deploy_status', {}) + new_target_deploy_status = stored_target_deploy_status.copy() + new_target_deploy_status[self.application_name] = { + 'workload-status': 'blocked', + 'workload-status-message': 'Invalid configuration', + } + if 'target_deploy_status' in self.test_config: + self.test_config['target_deploy_status'].update( + new_target_deploy_status) + else: + self.test_config['target_deploy_status'] = new_target_deploy_status + + with self.config_change( + {'bluestore-compression-mode': 'none'}, + {'bluestore-compression-mode': 'PEBCAK'}): + logging.info('Charm went into blocked state as expected, restore ' + 'configuration') + self.test_config[ + 'target_deploy_status'] = stored_target_deploy_status + + +def setup_osd_standalone(): + """Perform the necessary steps to setup a single OSD.""" + cmds = ['sudo ceph osd crush rule rm replicated_rule', + 'sudo ceph osd crush rule create-replicated replicated_rule ' + 'default osd', + 'sudo ceph osd erasure-code-profile rm default', + 'sudo ceph osd erasure-code-profile set default ' + 'plugin=jerasure k=2 m=1 crush-failure-domain=osd'] + for cmd in cmds: + model.run_on_unit('ceph-mon/0', cmd) + + loops = [] + for file in ('l1', 'l2', 'l3'): + model.run_on_unit('ceph-osd/0', 'touch %s' % file) + model.run_on_unit('ceph-osd/0', 'truncate --size 2G ./%s' % file) + out = model.run_on_unit('ceph-osd/0', + 'sudo losetup -fP --show ./%s' % file) + loops.append(out['Stdout'].strip()) + + for loop in loops: + model.run_action_on_leader('ceph-osd', 'add-disk', + action_params={'osd-devices': loop}) + + states = None + try: + model.get_application('ubuntu') + states = {'ubuntu': {'workload-status-message': ''}} + except KeyError: + pass + + model.wait_for_application_states(states=states) diff --git a/src/tests/tests.yaml b/src/tests/tests.yaml index 0b79d63..cb6d647 100644 --- a/src/tests/tests.yaml +++ b/src/tests/tests.yaml @@ -1,24 +1,24 @@ charm_name: ceph-fs -gate_bundles: - - bluestore-compression: focal-ussuri -dev_bundles: -smoke_bundles: configure: - - zaza.openstack.charm_tests.glance.setup.add_lts_image - - zaza.openstack.charm_tests.neutron.setup.basic_overcloud_network - - zaza.openstack.charm_tests.nova.setup.create_flavors - - zaza.openstack.charm_tests.nova.setup.manage_ssh_key - - zaza.openstack.charm_tests.keystone.setup.add_demo_user - - bluestore-compression: - - zaza.openstack.charm_tests.glance.setup.add_lts_image - - zaza.openstack.charm_tests.neutron.setup.basic_overcloud_network - - zaza.openstack.charm_tests.nova.setup.create_flavors - - zaza.openstack.charm_tests.nova.setup.manage_ssh_key - - zaza.openstack.charm_tests.keystone.setup.add_demo_user + - tests.target.setup_osd_standalone tests: - - zaza.openstack.charm_tests.ceph.fs.tests.CephFSTests - - zaza.openstack.charm_tests.ceph.fs.tests.CharmOperationTest - - bluestore-compression: - - zaza.openstack.charm_tests.ceph.fs.tests.CephFSTests - - zaza.openstack.charm_tests.ceph.fs.tests.CharmOperationTest - - zaza.openstack.charm_tests.ceph.tests.BlueStoreCompressionCharmOperation + - tests.target.CephFSTests + - tests.target.CharmOperationTest + - tests.target.BlueStoreCompressionCharmOperation + +target_deploy_status: + ubuntu: + workload-status: active + workload-status-message-prefix: '' + + ceph-osd: + workload-status: blocked + workload-status-message: 'No block devices detected using current configuration' + + ceph-fs: + workload-status: waiting + workload-status-message: "'ceph-mds' incomplete" + + ceph-mon: + workload-status: waiting + workload-status-message: 'Monitor bootstrapped but waiting' diff --git a/src/tox.ini b/src/tox.ini index b40d295..49a8b7e 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -27,6 +27,7 @@ minversion = 3.18.0 [testenv] setenv = VIRTUAL_ENV={envdir} PYTHONHASHSEED=0 + TEST_JUJU3=1 allowlist_externals = juju passenv = HOME TERM CS_* OS_* TEST_* deps = -r{toxinidir}/test-requirements.txt diff --git a/tox.ini b/tox.ini index 2d60b8a..be8c065 100644 --- a/tox.ini +++ b/tox.ini @@ -23,6 +23,7 @@ requires = pip < 20.3 virtualenv < 20.0 setuptools<50.0.0 + tox < 4.0.0 # NOTE: https://wiki.canonical.com/engineering/OpenStack/InstallLatestToxOnOsci minversion = 3.18.0 @@ -34,6 +35,7 @@ setenv = VIRTUAL_ENV={envdir} LAYER_PATH={toxinidir}/layers INTERFACE_PATH={toxinidir}/interfaces JUJU_REPOSITORY={toxinidir}/build + TEST_JUJU3=1 passenv = http_proxy https_proxy INTERFACE_PATH LAYER_PATH JUJU_REPOSITORY install_command = {toxinidir}/pip.sh install {opts} {packages} @@ -50,7 +52,7 @@ basepython = python3 deps = -r{toxinidir}/build-requirements.txt commands = charmcraft clean - charmcraft -v build + charmcraft -v pack {toxinidir}/rename.sh [testenv:build-reactive] @@ -96,21 +98,8 @@ commands = stestr run --slowest {posargs} [testenv:pep8] basepython = python3 deps = flake8==3.9.2 - charm-tools==2.8.3 commands = flake8 {posargs} src unit_tests -[testenv:func-target] -# Hack to get functional tests working in the charmcraft -# world. We should fix this. -basepython = python3 -passenv = HOME TERM CS_* OS_* TEST_* -deps = -r{toxinidir}/src/test-requirements.txt -changedir = {toxinidir}/src -commands = - bash -c "if [ ! -f ../*.charm ]; then echo 'Charm does not exist. Run tox -e build'; exit 1; fi" - tox --version - tox -e func-target {posargs} - [testenv:cover] # Technique based heavily upon # https://github.com/openstack/nova/blob/master/tox.ini From 967eca8524321e80a468eb4c9bb6ec2abebd476f Mon Sep 17 00:00:00 2001 From: Luciano Lo Giudice Date: Wed, 29 May 2024 14:41:15 -0300 Subject: [PATCH 2/5] Fix charmcraft.yaml and requirements file --- charmcraft.yaml | 8 ++++---- requirements.txt | 13 +++---------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/charmcraft.yaml b/charmcraft.yaml index 8fba7be..f7de183 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -10,13 +10,13 @@ parts: apt-get install ca-certificates -y tox -e build-reactive override-stage: | - echo "Copying charm to staging area: $CHARMCRAFT_STAGE" - NAME=$(ls $CHARMCRAFT_PART_BUILD/build/builds) - cp -r $CHARMCRAFT_PART_BUILD/build/builds/$NAME/* $CHARMCRAFT_STAGE/ + echo "Copying charm to staging area: $CRAFT_STAGE" + NAME=$(ls $CRAFT_PART_BUILD/build/builds) + cp -r $CRAFT_PART_BUILD/build/builds/$NAME/* $CRAFT_STAGE/ override-prime: | # For some reason, the normal priming chokes on the fact that there's a # hooks directory. - cp -r $CHARMCRAFT_STAGE/* . + cp -r $CRAFT_STAGE/* . bases: - build-on: diff --git a/requirements.txt b/requirements.txt index a68620f..e82a901 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,16 +8,9 @@ # requirements.txt setuptools<50.0.0 # https://github.com/pypa/setuptools/commit/04e3df22df840c6bb244e9b27bc56750c44b7c85 +cryptography<3.4 + # Build requirements -cffi==1.14.6; python_version < '3.6' # cffi 1.15.0 drops support for py35. -charm-tools==2.8.3 +git+https://github.com/juju/charm-tools.git simplejson - -# Newer versions use keywords that didn't exist in python 3.5 yet (e.g. -# "ModuleNotFoundError") -# NOTE(lourot): This might look like a duplication of test-requirements.txt but -# some tox targets use only test-requirements.txt whereas charm-build uses only -# requirements.txt -importlib-metadata<3.0.0; python_version < '3.6' -importlib-resources<3.0.0; python_version < '3.6' From ca41fa077f9adca28d97d862d5e44c1f695f29f6 Mon Sep 17 00:00:00 2001 From: Luciano Lo Giudice Date: Wed, 29 May 2024 14:51:25 -0300 Subject: [PATCH 3/5] Fix base on charmcraft --- charmcraft.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/charmcraft.yaml b/charmcraft.yaml index f7de183..a0b7981 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -30,3 +30,5 @@ bases: run-on: - name: ubuntu channel: "18.04" + - name: ubuntu + channel: "20.04" From cc4790ec12c0fb396e69dc0d1765424079b3b384 Mon Sep 17 00:00:00 2001 From: Luciano Lo Giudice Date: Wed, 29 May 2024 15:02:51 -0300 Subject: [PATCH 4/5] Update bundle --- src/tests/bundles/focal-ussuri.yaml | 210 +++------------------------- 1 file changed, 16 insertions(+), 194 deletions(-) diff --git a/src/tests/bundles/focal-ussuri.yaml b/src/tests/bundles/focal-ussuri.yaml index 05ddf56..456a75e 100644 --- a/src/tests/bundles/focal-ussuri.yaml +++ b/src/tests/bundles/focal-ussuri.yaml @@ -1,46 +1,26 @@ variables: - openstack-origin: &openstack-origin distro + openstack-origin: &openstack-origin cloud:focal-ussuri + +local_overlay_enabled: False series: &series focal machines: '0': - constraints: "mem=3072M" '1': - constraints: "mem=3072M" + constraints: virt-type=virtual-machine mem=4G '2': - constraints: "mem=3072M" + constraints: virt-type=virtual-machine mem=4G '3': - + constraints: virt-type=virtual-machine mem=4G applications: - - keystone-mysql-router: - charm: ch:mysql-router - channel: 8.0/edge - glance-mysql-router: - charm: ch:mysql-router - channel: 8.0/edge - nova-cloud-controller-mysql-router: - charm: ch:mysql-router - channel: 8.0/edge - placement-mysql-router: - charm: ch:mysql-router - channel: 8.0/edge - neutron-api-mysql-router: - charm: ch:mysql-router - channel: 8.0/edge - - mysql-innodb-cluster: - charm: ch:mysql-innodb-cluster - num_units: 3 - options: - source: *openstack-origin + ubuntu: # used to test mounts + charm: ch:ubuntu + num_units: 2 to: - - '0' - - '1' - '2' - channel: 8.0/edge + - '3' ceph-fs: charm: ../../../ceph-fs.charm @@ -51,17 +31,17 @@ applications: ec-profile-k: 4 ec-profile-m: 2 to: - - '3' + - '2' ceph-osd: charm: ch:ceph-osd - num_units: 6 - storage: - osd-devices: 'cinder,10G' + num_units: 1 options: osd-devices: '/dev/test-non-existent' source: *openstack-origin channel: octopus/edge + to: + - '1' ceph-mon: charm: ch:ceph-mon @@ -70,170 +50,12 @@ applications: monitor-count: '3' source: *openstack-origin channel: octopus/edge - - rabbitmq-server: - charm: ch:rabbitmq-server - num_units: 1 - options: - source: *openstack-origin - channel: 3.8/edge - - keystone: - expose: True - charm: ch:keystone - num_units: 1 - options: - openstack-origin: *openstack-origin - channel: ussuri/edge - - glance: - expose: True - charm: ch:glance - num_units: 1 - options: - openstack-origin: *openstack-origin - channel: ussuri/edge - - nova-cloud-controller: - expose: True - charm: ch:nova-cloud-controller - num_units: 1 - options: - network-manager: Neutron - openstack-origin: *openstack-origin - channel: ussuri/edge - - nova-compute: - charm: ch:nova-compute - num_units: 2 - constraints: mem=8G - options: - config-flags: default_ephemeral_format=ext4 - enable-live-migration: true - enable-resize: true - migration-auth-type: ssh - openstack-origin: *openstack-origin - channel: ussuri/edge - - placement: - charm: ch:placement - num_units: 1 - options: - openstack-origin: *openstack-origin - channel: ussuri/edge - - neutron-api: - charm: ch:neutron-api - num_units: 1 - options: - manage-neutron-plugin-legacy-mode: true - neutron-plugin: ovs - flat-network-providers: physnet1 - neutron-security-groups: true - openstack-origin: *openstack-origin - channel: ussuri/edge - - neutron-openvswitch: - charm: ch:neutron-openvswitch - channel: ussuri/edge - - neutron-gateway: - charm: ch:neutron-gateway - num_units: 1 - options: - bridge-mappings: physnet1:br-ex - openstack-origin: *openstack-origin - channel: ussuri/edge + to: + - '0' relations: - - - 'ceph-mon:mds' - 'ceph-fs:ceph-mds' - - - 'nova-compute:amqp' - - 'rabbitmq-server:amqp' - - - - 'nova-compute:image-service' - - 'glance:image-service' - - - - 'nova-compute:ceph' - - 'ceph-mon:client' - - - - 'keystone:shared-db' - - 'keystone-mysql-router:shared-db' - - - 'keystone-mysql-router:db-router' - - 'mysql-innodb-cluster:db-router' - - - - 'glance:shared-db' - - 'glance-mysql-router:shared-db' - - - 'glance-mysql-router:db-router' - - 'mysql-innodb-cluster:db-router' - - - - 'glance:identity-service' - - 'keystone:identity-service' - - - - 'glance:amqp' - - 'rabbitmq-server:amqp' - - - - 'glance:ceph' - - 'ceph-mon:client' - - - 'ceph-osd:mon' - 'ceph-mon:osd' - - - - 'nova-cloud-controller:shared-db' - - 'nova-cloud-controller-mysql-router:shared-db' - - - 'nova-cloud-controller-mysql-router:db-router' - - 'mysql-innodb-cluster:db-router' - - - - 'nova-cloud-controller:identity-service' - - 'keystone:identity-service' - - - - 'nova-cloud-controller:amqp' - - 'rabbitmq-server:amqp' - - - - 'nova-cloud-controller:cloud-compute' - - 'nova-compute:cloud-compute' - - - - 'nova-cloud-controller:image-service' - - 'glance:image-service' - - - - 'placement:shared-db' - - 'placement-mysql-router:shared-db' - - - 'placement-mysql-router:db-router' - - 'mysql-innodb-cluster:db-router' - - - - 'placement' - - 'keystone' - - - - 'placement' - - 'nova-cloud-controller' - - - - 'neutron-api:shared-db' - - 'neutron-api-mysql-router:shared-db' - - - 'neutron-api-mysql-router:db-router' - - 'mysql-innodb-cluster:db-router' - - - - 'neutron-api:amqp' - - 'rabbitmq-server:amqp' - - - - 'neutron-api:neutron-api' - - 'nova-cloud-controller:neutron-api' - - - - 'neutron-api:neutron-plugin-api' - - 'neutron-gateway:neutron-plugin-api' - - - - 'neutron-api:identity-service' - - 'keystone:identity-service' - - - - 'nova-compute:neutron-plugin' - - 'neutron-openvswitch:neutron-plugin' - - - - 'neutron-gateway:amqp' - - 'rabbitmq-server:amqp' - - - - 'neutron-openvswitch:amqp' - - 'rabbitmq-server:amqp' - - - - 'nova-cloud-controller:quantum-network-service' - - 'neutron-gateway:quantum-network-service' From 0da63417494a2a18dc0fefbb7845e7deec362233 Mon Sep 17 00:00:00 2001 From: Luciano Lo Giudice Date: Wed, 29 May 2024 15:14:19 -0300 Subject: [PATCH 5/5] Update openstack-origin in bundle --- src/tests/bundles/focal-ussuri.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/bundles/focal-ussuri.yaml b/src/tests/bundles/focal-ussuri.yaml index 456a75e..9e77904 100644 --- a/src/tests/bundles/focal-ussuri.yaml +++ b/src/tests/bundles/focal-ussuri.yaml @@ -1,5 +1,5 @@ variables: - openstack-origin: &openstack-origin cloud:focal-ussuri + openstack-origin: &openstack-origin distro local_overlay_enabled: False