Unable to create SDN subnet with netbox integration if bigger prefix pool already exists

lumarel

New Member
Feb 6, 2025
9
4
3
I was looking into an issue where PVE presents me this error when trying to create a SDN subnet:
create sdn subnet object failed: prefix 10.1.50.0/24 already exists in netbox at /usr/share/perl5/PVE/Network/SDN/Ipams/NetboxPlugin.pm line 80. (500)

The thing is there is a bigger prefix that includes the to be created prefix, and due to that it's unwilling.
In this case 10.1.0.0/16, but that's by design in netbox that you can nest prefixes.

As far as I could find out, this comes from this line:
https://github.com/proxmox/pve-network/blob/master/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm#L405

Tbh this should be ?prefix= instead of ?q= to only match the exact prefix.

Tested this with PVE 8.4.1 and Netbox 4.2.5

Cheers, Lukas
 
Hello,
thanks for your investigation.

I have not enough clue about the code.
But - its more then simple "match the exact prefix."
https://netboxlabs.com/docs/netbox/models/ipam/prefix/
Hi there!

Do you mean the same prefix in multiple VRFs part? Yes another consideration.
Or did I miss even more?

The thing is as far as I understand the current implementation it wants to check if the prefix already exists and if yes it should fail, but instead if any related prefix exists it will fail (i.e. prefix in other prefix)

At least from the PVE standpoint the check is all about if it will be able to create the prefix/ipaddress object.
 
Hi there!
Do you mean the same prefix in multiple VRFs part? Yes another consideration.
Or did I miss even more?

The thing is as far as I understand the current implementation it wants to check if the prefix already exists and if yes it should fail, but instead if any related prefix exists it will fail (i.e. prefix in other prefix)

At least from the PVE standpoint the check is all about if it will be able to create the prefix/ipaddress object.
yes .. the rabbithole: https://forum.proxmox.com/threads/s...-ip-10-0-0-1-already-exist.164102/post-777211