Bug when creating a fully-populated LB with allowed_cidr

Bug #2057751 reported by Gregory Thiemonge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
octavia
Fix Released
Medium
Gregory Thiemonge

Bug Description

When creating a LB + a listener with allowed_cidr, the octavia API returns an error:

REQ: curl -g -i -X POST http://192.168.1.101/load-balancer/v2.0/lbaas/loadbalancers -H "Content-Type: application/json" -H "User-Agent: openstacksdk/3.0.1 keystoneauth1/5.6.0 python-requests/2.31.0 CPython/3.9.18" -H "X-Auth-Token: {SHA256}40961cec98ffc6d45b89eb752fc0719fe147e2ff02d15db04f7161bc881fbb03" -d '{"loadbalancer": {"vip_subnet_id": "88ce5cfc-a49a-4d17-b228-3cefeb096dd5", "name": "lb1", "listeners": [{"protocol_port": 80, "protocol": "HTTP", "allowed_cidrs": ["10.0.0.0/8"]}]}}'
RESP: [500] Connection: close Content-Length: 111 Content-Type: application/json Date: Wed, 13 Mar 2024 08:08:21 GMT Server: Apache/2.4.57 (CentOS Stream) OpenSSL/3.0.7 mod_wsgi/4.7.1 Python/3.9 x-openstack-request-id: req-c399a2a2-a2a2-4449-8806-285219d3bb21
RESP BODY: {"faultcode": "Server", "faultstring": "None does not appear to be an IPv4 or IPv6 address", "debuginfo": null}
POST call to load-balancer for http://192.168.1.101/load-balancer/v2.0/lbaas/loadbalancers used request id req-c399a2a2-a2a2-4449-8806-285219d3bb21
Traceback (most recent call last):
  File "/home/cloud-user/loadbalancer-create.py", line 23, in <module>
    lb = conn.load_balancer.create_load_balancer(**tree)
  File "/opt/stack/openstacksdk/openstack/load_balancer/v2/_proxy.py", line 61, in create_load_balancer
    return self._create(_lb.LoadBalancer, **attrs)
  File "/opt/stack/openstacksdk/openstack/proxy.py", line 644, in _create
    return res.create(self, base_path=base_path)
  File "/opt/stack/openstacksdk/openstack/resource.py", line 1533, in create
    self._translate_response(response, **response_kwargs)
  File "/opt/stack/openstacksdk/openstack/resource.py", line 1285, in _translate_response
    exceptions.raise_from_response(response, error_message=error_message)
  File "/opt/stack/openstacksdk/openstack/exceptions.py", line 247, in raise_from_response
    raise cls(
openstack.exceptions.HttpException: HttpException: 500: Server Error for url: http://192.168.1.101/load-balancer/v2.0/lbaas/loadbalancers, None does not appear to be an IPv4 or IPv6 address

In Octavia API logs:

Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: ERROR wsme.api [None req-c399a2a2-a2a2-4449-8806-285219d3bb21 demo admin] Server-side error: "None does not appear to be an IPv4 or IPv6 address". Detail:
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: Traceback (most recent call last):
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: File "/usr/local/lib/python3.9/site-packages/wsmeext/pecan.py", line 82, in callfunction
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: result = f(self, *args, **kwargs)
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: File "/opt/stack/octavia/octavia/api/v2/controllers/load_balancer.py", line 583, in post
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: lock_session.rollback()
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: File "/usr/local/lib/python3.9/site-packages/oslo_utils/excutils.py", line 227, in __exit__
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: self.force_reraise()
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: File "/usr/local/lib/python3.9/site-packages/oslo_utils/excutils.py", line 200, in force_reraise
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: raise self.value
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: File "/opt/stack/octavia/octavia/api/v2/controllers/load_balancer.py", line 561, in post
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: db_pools, db_lists = self._graph_create(
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: File "/opt/stack/octavia/octavia/api/v2/controllers/load_balancer.py", line 695, in _graph_create
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: new_lists.append(listener.ListenersController()._graph_create(
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: File "/opt/stack/octavia/octavia/api/v2/controllers/listener.py", line 440, in _graph_create
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: db_listener = self._validate_create_listener(
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: File "/opt/stack/octavia/octavia/api/v2/controllers/listener.py", line 318, in _validate_create_listener
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: self._validate_cidr_compatible_with_vip(vip_addresses, allowed_cidrs)
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: File "/opt/stack/octavia/octavia/api/v2/controllers/listener.py", line 165, in _validate_cidr_compatible_with_vip
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: common_utils.is_ipv6(vip)):
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: File "/opt/stack/octavia/octavia/common/utils.py", line 87, in is_ipv6
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: ip = ipaddress.ip_address(ip_address)
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: File "/usr/lib64/python3.9/ipaddress.py", line 53, in ip_address
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 address')
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]: ValueError: None does not appear to be an IPv4 or IPv6 address
Mar 13 04:08:22 gthiemon-devstack <email address hidden>[3522046]:

It appears that the ip_address of the vip is None in [0], however the VIP object has been updated before calling this function.

[0] https://opendev.org/openstack/octavia/src/commit/ffc6f83f07b088fbd8979a5610fa371ff5c6467e/octavia/api/v2/controllers/listener.py#L165

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to octavia (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/octavia/+/912721

Changed in octavia:
status: New → In Progress
Changed in octavia:
assignee: nobody → Gregory Thiemonge (gthiemonge)
status: In Progress → New
Changed in octavia:
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to octavia (master)

Reviewed: https://review.opendev.org/c/openstack/octavia/+/912721
Committed: https://opendev.org/openstack/octavia/commit/5d9b23c6021ad961fafc17866c6b8ea50f2dc824
Submitter: "Zuul (22348)"
Branch: master

commit 5d9b23c6021ad961fafc17866c6b8ea50f2dc824
Author: Gregory Thiemonge <email address hidden>
Date: Wed Mar 13 04:31:17 2024 -0400

    Fix fully-populated API with allowed_cidrs

    When creating a LB + a listener with an allowed_cidr with the
    fully-populated API, an issue happened when Octavia validated that the
    allowed_cidrs and the VIP ip address have the same IP version. The
    vip.ip_address value was not updated in the load balancer object,
    forcing the expiration of the DB object before entering _graph_create
    fixes this issue.

    Note: there's no change in the tests, the test function for this feature
    exists, looks correct, and passes successfully, the bug is only
    reproducible in octavia-api.

    Closes-Bug: 2057751
    Change-Id: Ia106d81c1b2588e5d938d2238c8a2f6660bf5ef1

Changed in octavia:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to octavia (stable/2024.1)

Fix proposed to branch: stable/2024.1
Review: https://review.opendev.org/c/openstack/octavia/+/916099

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to octavia (stable/2023.2)

Fix proposed to branch: stable/2023.2
Review: https://review.opendev.org/c/openstack/octavia/+/916100

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to octavia (stable/2023.1)

Fix proposed to branch: stable/2023.1
Review: https://review.opendev.org/c/openstack/octavia/+/916761

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to octavia (stable/2024.1)

Reviewed: https://review.opendev.org/c/openstack/octavia/+/916099
Committed: https://opendev.org/openstack/octavia/commit/8d1998299f9972e6244d92c4937a19b6fa01c0a1
Submitter: "Zuul (22348)"
Branch: stable/2024.1

commit 8d1998299f9972e6244d92c4937a19b6fa01c0a1
Author: Gregory Thiemonge <email address hidden>
Date: Wed Mar 13 04:31:17 2024 -0400

    Fix fully-populated API with allowed_cidrs

    When creating a LB + a listener with an allowed_cidr with the
    fully-populated API, an issue happened when Octavia validated that the
    allowed_cidrs and the VIP ip address have the same IP version. The
    vip.ip_address value was not updated in the load balancer object,
    forcing the expiration of the DB object before entering _graph_create
    fixes this issue.

    Note: there's no change in the tests, the test function for this feature
    exists, looks correct, and passes successfully, the bug is only
    reproducible in octavia-api.

    Closes-Bug: 2057751
    Change-Id: Ia106d81c1b2588e5d938d2238c8a2f6660bf5ef1
    (cherry picked from commit 5d9b23c6021ad961fafc17866c6b8ea50f2dc824)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to octavia (stable/2023.2)

Reviewed: https://review.opendev.org/c/openstack/octavia/+/916100
Committed: https://opendev.org/openstack/octavia/commit/a1d422fe7fbc8a7e5d4c8a54a7ffcd1ba0f15352
Submitter: "Zuul (22348)"
Branch: stable/2023.2

commit a1d422fe7fbc8a7e5d4c8a54a7ffcd1ba0f15352
Author: Gregory Thiemonge <email address hidden>
Date: Wed Mar 13 04:31:17 2024 -0400

    Fix fully-populated API with allowed_cidrs

    When creating a LB + a listener with an allowed_cidr with the
    fully-populated API, an issue happened when Octavia validated that the
    allowed_cidrs and the VIP ip address have the same IP version. The
    vip.ip_address value was not updated in the load balancer object,
    forcing the expiration of the DB object before entering _graph_create
    fixes this issue.

    Note: there's no change in the tests, the test function for this feature
    exists, looks correct, and passes successfully, the bug is only
    reproducible in octavia-api.

    Closes-Bug: 2057751
    Change-Id: Ia106d81c1b2588e5d938d2238c8a2f6660bf5ef1
    (cherry picked from commit 5d9b23c6021ad961fafc17866c6b8ea50f2dc824)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to octavia (stable/2023.1)

Reviewed: https://review.opendev.org/c/openstack/octavia/+/916761
Committed: https://opendev.org/openstack/octavia/commit/d943336c0eb7461838a040e263355003682df960
Submitter: "Zuul (22348)"
Branch: stable/2023.1

commit d943336c0eb7461838a040e263355003682df960
Author: Gregory Thiemonge <email address hidden>
Date: Wed Mar 13 04:31:17 2024 -0400

    Fix fully-populated API with allowed_cidrs

    When creating a LB + a listener with an allowed_cidr with the
    fully-populated API, an issue happened when Octavia validated that the
    allowed_cidrs and the VIP ip address have the same IP version. The
    vip.ip_address value was not updated in the load balancer object,
    forcing the expiration of the DB object before entering _graph_create
    fixes this issue.

    Note: there's no change in the tests, the test function for this feature
    exists, looks correct, and passes successfully, the bug is only
    reproducible in octavia-api.

    Closes-Bug: 2057751
    Change-Id: Ia106d81c1b2588e5d938d2238c8a2f6660bf5ef1
    (cherry picked from commit 5d9b23c6021ad961fafc17866c6b8ea50f2dc824)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.