ansible openstack.cloud.server module fails while creating an instance with floating ip attached

Bug #2080859 reported by Alexander Stepanov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openstacksdk
Fix Released
Undecided
Takashi Kajinami

Bug Description

Ansible openstack.cloud.server module (v2.2.0) using openstacksdk v4.0.0 fails while creating an instance with floating ip attached (openstack 2023.01) with the following stack trace:

...
   File "/home/user/venv/lib/python3.11/site-packages/openstack/cloud/_compute.py", line 1013, in create_server
     server = self.wait_for_server(
   File "/home/user/venv/lib/python3.11/site-packages/openstack/cloud/_compute.py", line 1153, in wait_for_server
     server = self.get_active_server(
   File "/home/user/venv/lib/python3.11/site-packages/openstack/cloud/_compute.py", line 1200, in get_active_server
     return self.add_ips_to_server(
   File "/home/user/venv/lib/python3.11/site-packages/openstack/cloud/_network_common.py", line 1412, in add_ips_to_server
     server = self._add_ip_from_pool(
   File "/home/user/venv/lib/python3.11/site-packages/openstack/cloud/_network_common.py", line 1247, in _add_ip_from_pool
     f_ip = self.create_floating_ip(
   File "/home/user/venv/lib/python3.11/site-packages/openstack/cloud/_network_common.py", line 765, in create_floating_ip
     return self._neutron_create_floating_ip(
   File "/home/user/venv/lib/python3.11/site-packages/openstack/cloud/_network_common.py", line 824, in _neutron_create_floating_ip
     network_id = network['id']
                         ~~~~~~~^^^^^^
TypeError: 'NoneType' object is not subscriptable

Ansible task (slightly redacted to avoid information disclosure) goes below:

    - name: "Create molecule instance"
      openstack.cloud.server:
        name: "name"
        image: "image"
        flavor: "flavor"
        security_groups: "allow_all"
        key_name: "keypair_name"
        nics:
          - net-name: "dev-net"
        boot_from_volume: true
        floating_ip_pools: ["fip-pool"]
        reuse_ips: false
        terminate_volume: true
        validate_certs: false
        volume_size: 20

Discussed (with a possible fix) in https://<email address hidden>/message/YLUOENFTV42P45D5KQGBDLEHPAAZA2Z6/ thread.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to openstacksdk (master)
Changed in openstacksdk:
status: New → In Progress
Changed in openstacksdk:
assignee: nobody → Takashi Kajinami (kajinamit)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on openstacksdk (master)

Change abandoned by "Stephen Finucane <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/openstacksdk/+/929553

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

Reviewed: https://review.opendev.org/c/openstack/openstacksdk/+/929548
Committed: https://opendev.org/openstack/openstacksdk/commit/b119c1be6dc2bf9fd7b8c7fd06c808c55c61bf0d
Submitter: "Zuul (22348)"
Branch: master

commit b119c1be6dc2bf9fd7b8c7fd06c808c55c61bf0d
Author: Takashi Kajinami <email address hidden>
Date: Tue Sep 17 00:55:57 2024 +0900

    Fix internal error when floating ip network is not found by name

    Ensure that the appropriate exception (NotFoundException) is raised
    in case the network is not found by the specified name, to avoid ugly
    TypeError raised from internal logic.

    Closes-Bug: #2080859
    Co-Authored-By: Alexander Stepanov <email address hidden>
    Change-Id: I12ee35c1fc1bd9691b230f0b5e3de9111f0d46a7

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

Fix proposed to branch: stable/2024.2
Review: https://review.opendev.org/c/openstack/openstacksdk/+/930014

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

Reviewed: https://review.opendev.org/c/openstack/openstacksdk/+/930014
Committed: https://opendev.org/openstack/openstacksdk/commit/2423ab4efd7c86b42d10228d993cf0655a9276d7
Submitter: "Zuul (22348)"
Branch: stable/2024.2

commit 2423ab4efd7c86b42d10228d993cf0655a9276d7
Author: Takashi Kajinami <email address hidden>
Date: Tue Sep 17 00:55:57 2024 +0900

    Fix internal error when floating ip network is not found by name

    Ensure that the appropriate exception (NotFoundException) is raised
    in case the network is not found by the specified name, to avoid ugly
    TypeError raised from internal logic.

    Closes-Bug: #2080859
    Co-Authored-By: Alexander Stepanov <email address hidden>
    Change-Id: I12ee35c1fc1bd9691b230f0b5e3de9111f0d46a7
    (cherry picked from commit b119c1be6dc2bf9fd7b8c7fd06c808c55c61bf0d)

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.