Fix tox4 error

tox.ini started failing with Tox4 which had some
incompatible changes.

Fixing tox.ini for tox4 changes.

The latest version of docker broke kuryr-libnetwork since
it removes external k/v support. We have to hardcode
to an older version of docker to workaround.

The CI failed to delete subnetpool since the subnet haven't
been deleted yet. This commit also fixed it.

Depends-On: https://review.opendev.org/c/openstack/devstack-plugin-container/+/875113
Change-Id: Id48bb7d92f2f5d9d08b44acf651dbba3bf2e924e
This commit is contained in:
Hongbin Lu 2023-01-31 03:41:13 +00:00
parent b33439ba71
commit 7fce4cd925
4 changed files with 18 additions and 4 deletions

View File

@ -24,6 +24,7 @@ KURYR_PROCESS_EXTERNAL_CONNECTIVITY=${KURYR_PROCESS_EXTERNAL_CONNECTIVITY:-True}
KURYR_DOCKER_ENGINE_PORT=${KURYR_DOCKER_ENGINE_PORT:-2375}
DOCKER_CLUSTER_STORE=${DOCKER_CLUSTER_STORE:-etcd://$SERVICE_HOST:$ETCD_PORT}
UBUNTU_DOCKER_VERSION=${UBUNTU_DOCKER_VERSION:-5:20.10.23~3-0~ubuntu-jammy}
GITREPO["kuryr"]=${KURYR_REPO:-${GIT_BASE}/openstack/kuryr.git}
GITBRANCH["kuryr"]=${KURYR_BRANCH:-$TARGET_BRANCH}

View File

@ -1859,6 +1859,21 @@ def ipam_release_pool():
'subnetpool.')
return flask.jsonify(const.SCHEMA['SUCCESS'])
# Delete subnets created by kuryr
filtered_subnets = _get_subnets_by_attrs(
subnetpool_id=pool_id)
for subnet in filtered_subnets:
try:
subnet_name = subnet.get('name')
if str(subnet_name).startswith(const.SUBNET_NAME_PREFIX):
app.neutron.delete_subnet(subnet['id'])
except n_exceptions.Conflict:
LOG.error("Subnet %s is in use, "
"can't be deleted.", subnet['id'])
except n_exceptions.NeutronClientException as ex:
LOG.error("Error happened during deleting a "
"subnet created by kuryr: %s", ex)
try:
app.neutron.delete_subnetpool(pool_id)
except n_exceptions.Conflict:

View File

@ -570,7 +570,7 @@ class TestKuryrIpam(base.TestKuryrBase):
if mock_app.tag_ext:
mock_list_subnetpools.assert_called_with(
id=fake_kuryr_subnetpool_id)
mock_list_subnets.assert_called_with(
mock_list_subnets.assert_any_call(
cidr=FAKE_IP4_CIDR)
mock_remove_tag.assert_called_with('subnets',
subnet_v4_id,

View File

@ -1,10 +1,8 @@
[tox]
minversion = 2.3.1
envlist = py38,pep8
skipsdist = True
[testenv]
basepython = python3
# Note the hash seed is set to 0 until neutron can be tested with a
# random hash seed successfully.
setenv = VIRTUAL_ENV={envdir}
@ -16,7 +14,7 @@ deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/up
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
whitelist_externals = sh
allowlist_externals = sh
find
commands = find . -type f -name "*.py[c|o]" -delete
stestr run {posargs}