/31 networks can be used for point-to-point interfaces and are used in Telco environments - RFC 3021 [0] describes such prefixes These subnets do not have DHCP or gateway and should be created with correct options. Neutron API allows such subnets creation, but some parts of neutron-server especially around IPAM and allocation pools will not allow its actual use [1]. This happens if code does not handle such network type, where the two possible addresses match the typical network and broadcast ones (first and last). For some drivers, additional work may be required to support them. For instance with OVN, support should be added to skip metadata port creation for such subnets [2] Typical test case would be to create a /31 subnet without DHCP/gateway/medatata, create 2 VMs using the 2 possible addresses and check connectivity between them [0] https://tools.ietf.org/html/rfc3021 [1] https://bugs.launchpad.net/neutron/+bug/1580927 [2] https://github.com/openstack/neutron/blob/da63adc96bf9f8eafd66d0aeea5d6f8f787420ed/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py#L2282
So IIUC, currently in Neutron with e.g. ML2/OVS we can do that but user needs to manually set --no-gateway and --no-dhcp for such subnet. And then it should works fine, right? In case of OVN driver there is an issue with metadata port which will be always created. If that is correct, what exactly we should do in this new RFE? Some API changes which will force no gateway and no dhcp in case of /31 subnets always? Or is it just about Metadata port in OVN driver (and some documentation about how to create such networks in Neutron)? I'm asking about that because I'm not sure if we really need to treat this as new RFE or just "bug" in OVN driver.
API allows the subnet creation indeed (remembering to skip gateway and DHCP), but it cannot be used after that. Testing with ML2/OVS I see same issue as in original linked LP, allocation pool and IP validity checks fail. Something like the original suggested change plus generate_pools() would need a similar update - it handles /31 networks but only by skipping allocation pool creation for them: https://opendev.org/openstack/neutron/src/branch/master/neutron/ipam/utils.py#L68 In same code, check_subnet_ip() also needs an update to allow the use of network itself as an IP