Avoid wrongly passing "no_fixed_ips" to Neutron

For ports without fixed IPs, Neutron expects "fixed_ips = []" as
it does not understand "no_fixed_ips", so Heat should not be
passing that.

The logic to avoid passing this key when creating ports without
fixed IPs via OS::Neutron::Ports was added but never included for
ports created via OS::Nova::Server.

story: 2011249
task: 51221
Change-Id: Id5b89cf3bd816b92b888665b88c26e5c9332e1a6
(cherry picked from commit c5e0a4479a)
(cherry picked from commit 64bdbb9bc6)
This commit is contained in:
Alejandro Santoyo 2024-10-25 12:38:40 +02:00 committed by Takashi Kajinami
parent 30d8fb37ed
commit 435f17f855

View File

@ -120,6 +120,8 @@ class ServerNetworkMixin(object):
# we should add fixed_ips only if subnet or ip were provided
if body:
kwargs.update({'fixed_ips': [body]})
if net_data.get(neutron_port.Port.NO_FIXED_IPS):
kwargs.update({'fixed_ips': []})
if security_groups:
sec_uuids = self.client_plugin(
@ -133,6 +135,7 @@ class ServerNetworkMixin(object):
kwargs.update(specs)
port_extra_keys = list(neutron_port.Port.EXTRA_PROPERTIES)
port_extra_keys.remove(neutron_port.Port.ALLOWED_ADDRESS_PAIRS)
port_extra_keys.remove(neutron_port.Port.NO_FIXED_IPS)
for key in port_extra_keys:
if extra_props.get(key) is not None:
kwargs[key] = extra_props.get(key)