yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #96002
[Bug 2112453] Re: subnet create with subnet-pool and --gateway none creates gateway ip
Reviewed: https://review.opendev.org/c/openstack/neutron/+/952335
Committed: https://opendev.org/openstack/neutron/commit/5cccd2112fad736967d70768e1d6ac60c7d47415
Submitter: "Zuul (22348)"
Branch: master
commit 5cccd2112fad736967d70768e1d6ac60c7d47415
Author: Rodolfo Alonso Hernandez <ralonsoh@xxxxxxxxxx>
Date: Wed Jun 11 08:17:22 2025 +0000
Allow empty gateway IP in subnets from subnet pools
When a subnet is created from a subnet pool, now is possible to undefine
the gateway IP. The new subnet created will have this value assigned to
None.
$ openstack subnet create --subnet-pool shared-default-subnetpool-v4 \
--network net14 snet14 --gateway None --format value \
--column gateway_ip
None
Closes-Bug: #2112453
Change-Id: I3bdd260f0f6b0259ff15cfe16a111bfe93b40749
** Changed in: neutron
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/2112453
Title:
subnet create with subnet-pool and --gateway none creates gateway ip
Status in neutron:
Fix Released
Bug description:
Using the "--gateway none" Option while creating a subnet from a
subnet pool does not work, it will create a gateway IP regardless.
Additionally providing a cidr via "--subnet-range " will make it work,
no gateway.
Providing subnet-range defeats the purpose of pools in our case. We
can update the subnet to disable the gateway in an additional step.
$ openstack subnet create --subnet-pool subnetpool --gateway none --network network subnet
+----------------------+--------------------------------------+
| Field | Value |
+----------------------+--------------------------------------+
| allocation_pools | 10.40.0.66-10.40.0.94 |
| cidr | 10.40.0.64/27 |
| created_at | 2025-06-04T09:41:44Z |
| description | |
| dns_nameservers | |
| dns_publish_fixed_ip | False |
| enable_dhcp | True |
| gateway_ip | 10.40.0.65 |
| host_routes | |
| id | 2dfdc96a-2cd7-46ba-8f3a-aac4ab5e5d6e |
| ip_version | 4 |
| ipv6_address_mode | None |
| ipv6_ra_mode | None |
| name | subnet |
| network_id | ff3312cc-3423-42d0-91cb-cbaed2dd367d |
| project_id | ba45f7b4569e4e368320a2efbf80f6ac |
| revision_number | 0 |
| segment_id | None |
| service_types | |
| subnetpool_id | e91584e4-6c38-4074-b7e7-f0c470108587 |
| tags | |
| updated_at | 2025-06-04T09:41:44Z |
+----------------------+--------------------------------------+
My guess is that in [1] there is an incomplete check if "--gateway none" was explicitly set, thus resulting in 'is_any_subnetpool_request = not (cidr or gateway_ip)' be true in that case and calling AnySubnetRequest.
In [2] was a check introduced to ensure a provided gateway ip is within a subnet, but it seems gateway none wasnt included to verify.
class SubnetRequestFactory:
"""Builds request using subnet info"""
@classmethod
def get_request(cls, context, subnet, subnetpool):
cidr = subnet.get('cidr')
cidr = cidr if validators.is_attr_set(cidr) else None
gateway_ip = subnet.get('gateway_ip')
gateway_ip = gateway_ip if validators.is_attr_set(gateway_ip) else None
subnet_id = subnet.get('id', uuidutils.generate_uuid())
is_any_subnetpool_request = not (cidr or gateway_ip)
if is_any_subnetpool_request:
[1] https://github.com/openstack/neutron/blob/master/neutron/ipam/requests.py
[2] https://bugs.launchpad.net/neutron/+bug/1904436
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/2112453/+subscriptions
References