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 c5e0a4479a635f46a821d59969428898406ee0cb)
(cherry picked from commit 64bdbb9bc66c38760989dd7bb2574ccc14069872)
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 # we should add fixed_ips only if subnet or ip were provided
if body: if body:
kwargs.update({'fixed_ips': [body]}) kwargs.update({'fixed_ips': [body]})
if net_data.get(neutron_port.Port.NO_FIXED_IPS):
kwargs.update({'fixed_ips': []})
if security_groups: if security_groups:
sec_uuids = self.client_plugin( sec_uuids = self.client_plugin(
@ -133,6 +135,7 @@ class ServerNetworkMixin(object):
kwargs.update(specs) kwargs.update(specs)
port_extra_keys = list(neutron_port.Port.EXTRA_PROPERTIES) 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.ALLOWED_ADDRESS_PAIRS)
port_extra_keys.remove(neutron_port.Port.NO_FIXED_IPS)
for key in port_extra_keys: for key in port_extra_keys:
if extra_props.get(key) is not None: if extra_props.get(key) is not None:
kwargs[key] = extra_props.get(key) kwargs[key] = extra_props.get(key)