Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for OpenStack Caracal release #9278

Merged
merged 22 commits into from
Jan 16, 2025

Conversation

nelljerram
Copy link
Member

@nelljerram nelljerram commented Sep 25, 2024

Update Calico's OpenStack integration code to work with the OpenStack Caracal release, and also with Ubuntu Jammy. Note that Caracal itself requires Jammy (in order to have libvirt >= 7.0.0).

Related issues/PRs

Fixes #9216

Fixes #9238

Release Note

Update Calico's OpenStack integration code to work with the OpenStack Caracal release, and also with Ubuntu Jammy.

@nelljerram nelljerram requested a review from a team as a code owner September 25, 2024 10:05
@marvin-tigera marvin-tigera added this to the Calico v3.30.0 milestone Sep 25, 2024
@marvin-tigera marvin-tigera added release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented labels Sep 25, 2024
@nelljerram nelljerram marked this pull request as draft September 25, 2024 10:05
@nelljerram
Copy link
Member Author

Our UTs are now OK with Caracal, but it looks like we have to update networking-calico to work with a newer version of etcd3gw (specifically, 2.4.0):

Sep 25 12:12:23 semaphore-vm neutron-server[156898]: INFO networking_calico.etcdv3 [-] TLS disabled, using HTTP to connect to etcd.
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: INFO networking_calico.etcdv3 [-] Try creating etcd3gw client with /v3/
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3 [-] etcd3gw client not working: TypeError: post() got multiple values for keyword argument 'timeout'
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3 Traceback (most recent call last):
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3   File "/opt/stack/data/venv/lib/python3.8/site-packages/networking_calico/etcdv3.py", line 455, in __init__
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3     status = self.status()
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3   File "/opt/stack/data/venv/lib/python3.8/site-packages/etcd3gw/client.py", line 152, in status
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3     return self.post(self.get_url("/maintenance/status"),
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3   File "/opt/stack/data/venv/lib/python3.8/site-packages/networking_calico/etcdv3.py", line 503, in post
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3     return super(Etcd3AuthClient, self).post(*args, **kwargs)
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3   File "/opt/stack/data/venv/lib/python3.8/site-packages/etcd3gw/client.py", line 145, in post
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3     return self._request('post', *args, **kwargs)
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3   File "/opt/stack/data/venv/lib/python3.8/site-packages/etcd3gw/client.py", line 123, in _request
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3     resp = getattr(self.session, method)(*args, timeout=self.timeout,
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3 TypeError: post() got multiple values for keyword argument 'timeout'
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3 
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: INFO networking_calico.etcdv3 [-] Try creating etcd3gw client with /v3beta/
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3 [-] etcd3gw client not working: TypeError: post() got multiple values for keyword argument 'timeout'
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3 Traceback (most recent call last):
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3   File "/opt/stack/data/venv/lib/python3.8/site-packages/networking_calico/etcdv3.py", line 455, in __init__
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3     status = self.status()
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3   File "/opt/stack/data/venv/lib/python3.8/site-packages/etcd3gw/client.py", line 152, in status
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3     return self.post(self.get_url("/maintenance/status"),
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3   File "/opt/stack/data/venv/lib/python3.8/site-packages/networking_calico/etcdv3.py", line 503, in post
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3     return super(Etcd3AuthClient, self).post(*args, **kwargs)
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3   File "/opt/stack/data/venv/lib/python3.8/site-packages/etcd3gw/client.py", line 145, in post
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3     return self._request('post', *args, **kwargs)
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3   File "/opt/stack/data/venv/lib/python3.8/site-packages/etcd3gw/client.py", line 123, in _request
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3     resp = getattr(self.session, method)(*args, timeout=self.timeout,
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3 TypeError: post() got multiple values for keyword argument 'timeout'
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3 
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: INFO networking_calico.etcdv3 [-] Try creating etcd3gw client with /v3alpha/
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3 [-] etcd3gw client not working: TypeError: post() got multiple values for keyword argument 'timeout'
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3 Traceback (most recent call last):
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3   File "/opt/stack/data/venv/lib/python3.8/site-packages/networking_calico/etcdv3.py", line 455, in __init__
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3     status = self.status()
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3   File "/opt/stack/data/venv/lib/python3.8/site-packages/etcd3gw/client.py", line 152, in status
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3     return self.post(self.get_url("/maintenance/status"),
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3   File "/opt/stack/data/venv/lib/python3.8/site-packages/networking_calico/etcdv3.py", line 503, in post
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3     return super(Etcd3AuthClient, self).post(*args, **kwargs)
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3   File "/opt/stack/data/venv/lib/python3.8/site-packages/etcd3gw/client.py", line 145, in post
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3     return self._request('post', *args, **kwargs)
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3   File "/opt/stack/data/venv/lib/python3.8/site-packages/etcd3gw/client.py", line 123, in _request
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3     resp = getattr(self.session, method)(*args, timeout=self.timeout,
Sep 25 12:12:23 semaphore-vm neutron-server[156898]: ERROR networking_calico.etcdv3 TypeError: post() got multiple values for keyword argument 'timeout'

    Cloning into '/opt/stack/calico'...
    fatal: detected dubious ownership in repository at '/home/semaphore/calico/.git'
    To add an exception for this directory, call:
    	git config --global --add safe.directory /home/semaphore/calico/.git
    + ./stack.sh:main:236                      :   echo 'WARNING: this script has not been tested on focal'
    WARNING: this script has not been tested on focal
    + ./stack.sh:main:237                      :   [[ '' != \y\e\s ]]
    + ./stack.sh:main:238                      :   die 238 'If you wish to run this script anyway run with FORCE=yes'
    + functions-common:die:285                 :   local exitcode=0
    + functions-common:die:286                 :   set +o xtrace
    [Call Trace]
    ./stack.sh:238:die
    [ERROR] ./stack.sh:238 If you wish to run this script anyway run with FORCE=yes
In the job running tox with Caracal:

    running testr
    Traceback (most recent call last):
      File "setup.py", line 20, in <module>
        setup(
      File "/code/.tox/py38/lib/python3.8/site-packages/setuptools/__init__.py", line 117, in setup
        return distutils.core.setup(**attrs)
      File "/code/.tox/py38/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 183, in setup
        return run_commands(dist)

        dist.run_commands()
      File "/code/.tox/py38/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 954, in run_commands
        self.run_command(cmd)
      File "/code/.tox/py38/lib/python3.8/site-packages/setuptools/dist.py", line 950, in run_command
        super().run_command(command)
      File "/code/.tox/py38/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
        cmd_obj.run()
      File "/code/.tox/py38/lib/python3.8/site-packages/testrepository/setuptools_command.py", line 71, in run
        self._run_testr("init")
      File "/code/.tox/py38/lib/python3.8/site-packages/testrepository/setuptools_command.py", line 51, in _run_testr
        return commands.run_argv([sys.argv[0]] + list(args),
      File "/code/.tox/py38/lib/python3.8/site-packages/testrepository/commands/__init__.py", line 185, in run_argv

      File "/code/.tox/py38/lib/python3.8/site-packages/testrepository/ui/cli.py", line 23, in <module>
        from extras import try_import
    ModuleNotFoundError: No module named 'extras'
    ERROR: InvocationError for command /code/.tox/py38/bin/python setup.py testr --slowest --testr-args= (exited with code 1)
@nelljerram nelljerram force-pushed the openstack-caracal branch 2 times, most recently from 1a28d7d to 303976f Compare January 14, 2025 10:54
    + cd devstack
    + cat
    + true
    + sudo tools/create-stack-user.sh
    Creating a group called stack
    Creating a user called stack
    Executable permission missing for /opt/stack, adding it
    Giving stack user passwordless sudo privileges
    + cd ..
    + sudo mkdir -p /opt/stack
    + sudo mv devstack /opt/stack
    + sudo chown -R stack:stack /opt/stack
    + ls -la /opt/stack
    ls: cannot open directory '/opt/stack': Permission denied
    + functions-common:git_timed:709           :   timeout -s SIGINT 0 git clone --no-checkout /home/semaphore/calico /opt/stack/calico
    fatal: repository '/home/semaphore/calico' does not exist
    + ls -la /home/semaphore/calico
    ls: cannot access '/home/semaphore/calico': Permission denied
    + ls -la /home/
    total 16
    drwxr-xr-x  4 root      root      4096 Dec 18 16:07 .
    drwxr-xr-x 19 root      root      4096 Jan 14 14:18 ..
    drwxr-x---  5 builder   builder   4096 Dec 18 16:01 builder
    drwxr-x--- 24 semaphore semaphore 4096 Jan 14 14:38 semaphore
As discussed in projectcalico#9216; thank you to @sp3c1k for the fix.

We specify our DnsmasqRouted as the DHCP driver class.  Common Neutron DHCP agent code instantiates the DHCP driver, and between Yoga and Caracal that code has been modified to pass a new `segment` arg.
… not support

    Traceback (most recent call last):
      File "/opt/stack/tempest/.tox/venv/lib/python3.10/site-packages/oslo_config/cfg.py", line 2931, in _do_get
        return (convert(val), alt_loc)
      File "/opt/stack/tempest/.tox/venv/lib/python3.10/site-packages/oslo_config/cfg.py", line 2900, in convert
        return self._convert_value(
      File "/opt/stack/tempest/.tox/venv/lib/python3.10/site-packages/oslo_config/cfg.py", line 3028, in _convert_value
        return opt.type(value)
      File "/opt/stack/tempest/.tox/venv/lib/python3.10/site-packages/oslo_config/types.py", line 167, in __call__
        raise ValueError(
    ValueError: Valid values are [udhcpc, dhclient, ], but found 'dhcpcd'
Our _loop_writing_port_statuses thread periodically causes this WARNING traceback to be emitted from
the Neutron server:

    WARNING neutron.objects.base [None req-48e10ccd-8270-426f-bcc9-1b09be13a4f7 None None] ORM session: SQL execution without transaction in progress, traceback:
      File "/opt/stack/data/venv/lib/python3.10/site-packages/eventlet/greenthread.py", line 264, in main
        result = function(*args, **kwargs)
      File "/opt/stack/data/venv/lib/python3.10/site-packages/networking_calico/logutils.py", line 21, in wrapped
        return fn(*args, **kwargs)
      File "/opt/stack/data/venv/lib/python3.10/site-packages/networking_calico/plugins/ml2/drivers/calico/mech_calico.py", line 542, in _loop_writing_port_statuses
        self._try_to_update_port_status(admin_context, port_status_key)
      File "/opt/stack/data/venv/lib/python3.10/site-packages/networking_calico/plugins/ml2/drivers/calico/mech_calico.py", line 568, in _try_to_update_port_status
        self.db.update_port_status(admin_context,
      File "/opt/stack/neutron/neutron/plugins/ml2/plugin.py", line 2355, in update_port_status
        return self.update_port_statuses(
      File "/opt/stack/neutron/neutron/common/utils.py", line 723, in inner
        return f(*args, **kwargs)
      File "/opt/stack/data/venv/lib/python3.10/site-packages/neutron_lib/db/api.py", line 223, in wrapped
        return f_with_retry(*args, **kwargs,
      File "/opt/stack/data/venv/lib/python3.10/site-packages/neutron_lib/db/api.py", line 135, in wrapped
        return f(*args, **kwargs)
      File "/opt/stack/data/venv/lib/python3.10/site-packages/oslo_db/api.py", line 142, in wrapper
        return f(*args, **kwargs)
      File "/opt/stack/data/venv/lib/python3.10/site-packages/neutron_lib/db/api.py", line 181, in wrapped
        return f(*dup_args, **dup_kwargs)
      File "/opt/stack/neutron/neutron/plugins/ml2/plugin.py", line 2370, in update_port_statuses
        result[port_id] = self._safe_update_individual_port_db_status(
      File "/opt/stack/neutron/neutron/plugins/ml2/plugin.py", line 2378, in _safe_update_individual_port_db_status
        return self._update_individual_port_db_status(
      File "/opt/stack/neutron/neutron/plugins/ml2/plugin.py", line 2454, in _update_individual_port_db_status
        self.mechanism_manager.update_port_postcommit(mech_context)
      File "/opt/stack/neutron/neutron/plugins/ml2/managers.py", line 764, in update_port_postcommit
        self._call_on_drivers("update_port_postcommit", context,
      File "/opt/stack/neutron/neutron/plugins/ml2/managers.py", line 497, in _call_on_drivers
        getattr(driver.obj, method_name)(context)
      File "/opt/stack/data/venv/lib/python3.10/site-packages/networking_calico/plugins/ml2/drivers/calico/mech_calico.py", line 179, in wrapper
        return f(self, *args, **kwargs)
      File "/opt/stack/data/venv/lib/python3.10/site-packages/networking_calico/plugins/ml2/drivers/calico/mech_calico.py", line 827, in update_port_postcommit
        self.endpoint_syncer.write_endpoint(port,
      File "/opt/stack/data/venv/lib/python3.10/site-packages/networking_calico/plugins/ml2/drivers/calico/endpoints.py", line 157, in write_endpoint
        port = self.add_extra_port_information(context, port)
      File "/opt/stack/data/venv/lib/python3.10/site-packages/networking_calico/plugins/ml2/drivers/calico/endpoints.py", line 249, in add_extra_port_information
        port['fixed_ips'] = self.get_fixed_ips_for_port(
      File "/opt/stack/data/venv/lib/python3.10/site-packages/networking_calico/plugins/ml2/drivers/calico/endpoints.py", line 205, in get_fixed_ips_for_port
        return [
      File "/opt/stack/data/venv/lib/python3.10/site-packages/networking_calico/plugins/ml2/drivers/calico/endpoints.py", line 205, in <listcomp>
        return [
      File "/opt/stack/data/venv/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2901, in __iter__
        result = self._iter()
      File "/opt/stack/data/venv/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2916, in _iter
        result = self.session.execute(
      File "/opt/stack/data/venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1698, in execute
        result = fn(orm_exec_state)

Following https://review.opendev.org/c/openstack/neutron/+/863780, this change adds the
CONTEXT_WRITER decorator, in the hope of eliminating those tracebacks.
Because with the decorator present we get this ERROR traceback:

     Traceback (most recent call last):
       File "/opt/stack/data/venv/lib/python3.10/site-packages/eventlet/hubs/hub.py", line 471, in fire_timers
         timer()
       File "/opt/stack/data/venv/lib/python3.10/site-packages/eventlet/hubs/timer.py", line 59, in __call__
         cb(*args, **kw)
       File "/opt/stack/data/venv/lib/python3.10/site-packages/eventlet/greenthread.py", line 264, in main
         result = function(*args, **kwargs)
       File "/opt/stack/data/venv/lib/python3.10/site-packages/networking_calico/logutils.py", line 21, in wrapped
         return fn(*args, **kwargs)
       File "/opt/stack/data/venv/lib/python3.10/site-packages/networking_calico/plugins/ml2/drivers/calico/mech_calico.py", line 544, in _loop_writing_port_statuses
         self._try_to_update_port_status(admin_context, port_status_key)
       File "/opt/stack/data/venv/lib/python3.10/site-packages/oslo_db/sqlalchemy/enginefacade.py", line 998, in wrapper
         return fn(*args, **kwargs)
       File "/opt/stack/data/venv/lib/python3.10/site-packages/networking_calico/plugins/ml2/drivers/calico/mech_calico.py", line 571, in _try_to_update_port_status
         self.db.update_port_status(admin_context,
       File "/opt/stack/neutron/neutron/plugins/ml2/plugin.py", line 2355, in update_port_status
         return self.update_port_statuses(
       File "/opt/stack/neutron/neutron/common/utils.py", line 721, in inner
         raise RuntimeError(_("Method %s cannot be called within a "
     RuntimeError: Method <function Ml2Plugin.update_port_statuses at 0x7bf071174af0> cannot be called within a transaction.

(which is obviously worse than the WARNING without the decorator)

This reverts commit 21a6f06.
@nelljerram nelljerram changed the title WIP: Test with OpenStack Caracal release Support for OpenStack Caracal release Jan 16, 2025
@nelljerram nelljerram marked this pull request as ready for review January 16, 2025 10:00
Copy link
Member

@fasaxc fasaxc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nelljerram nelljerram merged commit 49bf43c into projectcalico:master Jan 16, 2025
6 checks passed
@nelljerram nelljerram deleted the openstack-caracal branch January 16, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/openstack docs-pr-required Change is not yet documented kind/enhancement release-note-required Change has user-facing impact (no matter how small)
Projects
None yet
3 participants