From da087c7f041985e5d270712adf1d6bc1eda7be32 Mon Sep 17 00:00:00 2001 From: Agustin Carranza Date: Tue, 30 May 2023 15:19:48 -0300 Subject: [PATCH] Change 'uses' parameter from UUID to iface name When creating a new interface, it can be selected a collection of 'used' interfaces by the new one. This functionality makes use of the sysinv API in which the parameter of such interfaces is required to be specified by the names of the interfaces and not by the UUID. This change looks for the names and replace the UUID for every selected interface. Test plan PASS: * Log in to Starlingx dashboard, navigate to a Host Detail. * Go to to the interface tab and click the 'Create Interface' button. * Select a compatible configuration and make sure to check an interface from the 'Interfaces' list. * The interface is created successfully. Closes-bug: 2021893 Signed-off-by: Agustin Carranza Change-Id: I1242f05a936ff3d69f28cc6ff0ea65fe53ffc4b5 --- .../dashboards/admin/inventory/interfaces/forms.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/interfaces/forms.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/interfaces/forms.py index a7fdca5b..cca98bc2 100644 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/interfaces/forms.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/interfaces/forms.py @@ -567,7 +567,12 @@ class AddInterface(forms.SelfHandlingForm): if data['ports']: del data['uses'] else: - uses = data['uses'][:] + uses = [] + iface_list = sysinv.host_interface_list(self.request, host_id) + for u in data['uses']: + for i in iface_list: + if u == i.uuid: + uses.append(i.ifname) data['uses'] = uses del data['ports']