[SRU] Cannot Create Port with Fixed IP Address

Bug #1900851 reported by Lazuardi Nasution
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
High
Akihiro Motoki
Ubuntu Cloud Archive
Fix Released
Undecided
Unassigned
Ussuri
New
Undecided
Unassigned
Victoria
Fix Released
Undecided
Unassigned
Wallaby
Fix Released
Undecided
Unassigned
Xena
Fix Released
Undecided
Unassigned
horizon (Ubuntu)
Fix Released
Undecided
Unassigned
Focal
New
Undecided
Unassigned
Groovy
Fix Released
Undecided
Unassigned
Hirsute
Fix Released
Undecided
Unassigned
Impish
Fix Released
Undecided
Unassigned

Bug Description

[Impact]
Fixes python 3.8 compatibility issue with port creation code.

[Test Plan]
 * deploy openstack ussuri
 * create a network port on horizon
 * ensure creation successful

[Regression Potential]
No unexpected behaviour is anticipated from this patch since it is minor and does not impact any code outside of the feature that it fixes.

=========================================================================

With Ussuri on Ubuntu 20.04, I can create port with fixed IP address by CLI but I cannot do the same by Horizon GUI. I find some error like following on /var/log/apache2/error.log

openstack_dashboard.dashboards.project.networks.ports.workflows Failed to create a port for network 91f04dfb-7f69-4050-8b3b-142ee555ae55: dictionary keys changed during iteration

By more inspection, I can find that horizon never send that create port request to neutron. So I think it is horizon problem. Is this expected result or is this horizon bug? Is this related to policy?

Following debug logs maybe related too.

[Wed Oct 21 17:48:06.123807 2020] [wsgi:error] [pid 3095280:tid 140002354386688] [remote 192.168.202.12:60886] DEBUG neutronclient.client GET call to neutron for http://10.7.55.18:9696/v2.0/extensions used request id req-95db8d1f-387b-492b-aff6-8238f09e504d
[Wed Oct 21 17:48:06.125925 2020] [wsgi:error] [pid 3095280:tid 140002354386688] [remote 192.168.202.12:60886] DEBUG django.template Exception while resolving variable 'add_to_field' in template 'horizon/common/_workflow.html'.
[Wed Oct 21 17:48:06.126064 2020] [wsgi:error] [pid 3095280:tid 140002354386688] [remote 192.168.202.12:60886] django.template.base.VariableDoesNotExist: Failed lookup for key [add_to_field] in [{'True': True, 'False': False, 'None': None}, {'csrf_token': <SimpleLazyObject: <function csrf.<locals>._get_val at 0x7f54c8e30f70>>, 'LANGUAGES': (('cs', 'Czech'), ('de', 'German'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('fr', 'French'), ('id', 'Indonesian'), ('it', 'Italian'), ('ja', 'Japanese'), ('ko', 'Korean (Korea)'), ('pl', 'Polish'), ('pt-br', 'Portuguese (Brazil)'), ('ru', 'Russian'), ('tr', 'Turkish'), ('zh-cn', 'Simplified Chinese'), ('zh-tw', 'Chinese (Taiwan)')), 'LANGUAGE_CODE': 'en', 'LANGUAGE_BIDI': False, 'request': <WSGIRequest: GET '/horizon/admin/networks/91f04dfb-7f69-4050-8b3b-142ee555ae55/ports/create'>, 'MEDIA_URL': '/horizon/media/', 'STATIC_URL': '/horizon/static/', 'messages': <django.contrib.messages.storage.fallback.FallbackStorage object at 0x7f54c90ef760>, 'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 'SUCCESS': 25, 'WARNING': 30, 'ERROR': 40}, 'HORIZON_CONFIG': <horizon.conf.LazySettings object at 0x7f54d07eb880>, 'True': True, 'False': False, 'authorized_tenants': [<Project description=Bootstrap project for initializing the cloud., domain_id=default, enabled=True, id=84725e39c7a9462495e2cb6ae0cd111b, is_domain=False, links={'self': 'http://10.7.55.18:5000/v3/projects/84725e39c7a9462495e2cb6ae0cd111b'}, name=admin, options={}, parent_id=default, tags=[]>], 'keystone_providers': {'support': False}, 'regions': {'support': False, 'current': {'endpoint': 'http://10.7.55.18:5000/v3/', 'name': 'Default Region'}, 'available': []}, 'WEBROOT': '/horizon/', 'USER_MENU_LINKS': [{'name': 'OpenStack RC File', 'icon_classes': ['fa-download'], 'url': 'horizon:project:api_access:openrc'}], 'LOGOUT_URL': '/horizon/auth/logout/', 'profiler_enabled': False, 'JS_CATALOG': 'horizon+openstack_dashboard'}, {}, {'network_id': '91f04dfb-7f69-4050-8b3b-142ee555ae55', 'view': <openstack_dashboard.dashboards.admin.networks.ports.views.CreateView object at 0x7f54c90aabb0>, 'modal_backdrop': 'static', 'workflow': <CreatePort: create_port>, 'REDIRECT_URL': None, 'layout': ['modal'], 'modal': True}, {'entry_point': 'create_info'}]

Related branches

Revision history for this message
Albert Damen (albrt) wrote :

I got the same error adding a port using horizon and was also able to create that port using CLI.

Google suggested the problem might be python3 related so I tried one of the suggested solutions: using a copy of the keys of the dictionary for the iteration. With that change I could create ports in Horizon again.

Horizon 18.3.2, Ubuntu 20.10 (groovy), python 3.8

Solution:
# diff -Nur /usr/lib/python3/dist-packages/openstack_dashboard/api/neutron.py.bak /usr/lib/python3/dist-packages/openstack_dashboard/api/neutron.py
--- /usr/lib/python3/dist-packages/openstack_dashboard/api/neutron.py.bak 2020-11-14 13:54:14.495049228 +0000
+++ /usr/lib/python3/dist-packages/openstack_dashboard/api/neutron.py 2020-11-14 14:04:38.716062069 +0000
@@ -1362,7 +1362,8 @@

 def unescape_port_kwargs(**kwargs):
- for key in kwargs:
+ key_copy = tuple(kwargs.keys())
+ for key in key_copy:
         if '__' in key:
             kwargs[':'.join(key.split('__'))] = kwargs.pop(key)
     return kwargs

Changed in horizon:
status: New → Confirmed
Akihiro Motoki (amotoki)
Changed in horizon:
importance: Undecided → High
assignee: nobody → Akihiro Motoki (amotoki)
tags: added: victoria-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.opendev.org/763161

Changed in horizon:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 19.0.0

This issue was fixed in the openstack/horizon 19.0.0 release.

Akihiro Motoki (amotoki)
Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 18.6.2

This issue was fixed in the openstack/horizon 18.6.2 release.

Changed in horizon (Ubuntu Impish):
status: New → Fix Released
Changed in horizon (Ubuntu Hirsute):
status: New → Fix Released
Changed in horizon (Ubuntu Groovy):
status: New → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/ussuri)

Fix proposed to branch: stable/ussuri
Review: https://review.opendev.org/c/openstack/horizon/+/799999

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

Reviewed: https://review.opendev.org/c/openstack/horizon/+/799999
Committed: https://opendev.org/openstack/horizon/commit/efa1b3d683d6147abeb3ac9573729a726c481468
Submitter: "Zuul (22348)"
Branch: stable/ussuri

commit efa1b3d683d6147abeb3ac9573729a726c481468
Author: Akihiro Motoki <email address hidden>
Date: Wed Nov 18 20:05:48 2020 +0900

    Fix create/update_port with python3

    unescape_port_kwargs() in api/neutron.py changes a key of dict
    during the iteration and it is not allowed in python3.

    Change-Id: Ifc1b9a0191aacd32e8c8ecc082b6313f04003f63
    Closes-Bug: #1900851
    (cherry picked from commit f3927ffb3d5e8803115a436f27d15cf52f61d2e0)
    (cherry picked from commit 69e688728c19093eebf3b514a663e714e715d632)

description: updated
summary: - Cannot Create Port with Fixed IP Address
+ [SRU] Cannot Create Port with Fixed IP Address
Revision history for this message
Edward Hope-Morley (hopem) wrote :

having issues uploaded my branch of ~ubuntu-openstack-dev/ubuntu/+source/horizon to lp so using a debdiff for now.

Revision history for this message
Edward Hope-Morley (hopem) wrote :

managed to get lp branch to upload so deleting the debdiff

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 18.3.4

This issue was fixed in the openstack/horizon 18.3.4 release.

Revision history for this message
Mateusz Pawlowski (mateusz-p) wrote :

@hopem is there any ETA when 18.3.4 will be available for Ussuri?

Thanks

Revision history for this message
João Pedro Seara (jpseara) wrote (last edit ):

Hello,

I am also interested in knowing the ETA for Ussuri.

Revision history for this message
Tiago Pasqualini da Silva (tiago.pasqualini) wrote :

Hi Mateusz and JP,

This has been fixed and released through another bug: https://bugs.launchpad.net/cloud-archive/+bug/1941048

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.