Is it thread-safe to get and assign IP? #11127
-
Hi, Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
The |
Beta Was this translation helpful? Give feedback.
-
Hi @jeremystretch , Netbox VERSION = '2.5.13' What version of Netbox is Thread-safe? I just tested with JMeter. Three Separate device IDs got 2 of them the same IP address and one of them failed with an error via REST-API. I have done these API calls via JMeter and I can re-produce this: Request: POST http://localhost:8000/api/ipam/prefixes/1/available-ips/?contiguous=true POST data:
] POST http://localhost:8000/api/ipam/prefixes/1/available-ips/?contiguous=true POST data:
] Response:
|
Beta Was this translation helpful? Give feedback.
-
The release notes are available here: https://github.com/netbox-community/netbox/tree/develop/docs/release-notes EDIT: locking for the
It was reimplemented in commit bace24b in v3.5.5 (I'm not sure if it had been lost before then). For creation of specified IP addresses, it looks like this was implemented in v3.3.7:
That was released four and a half years ago (May 31, 2019), so Netbox today has moved on a long way. You can find other threads in this discussion group about how to go about such a major upgrade, but in short:
I would strongly recommend not doing an in-place upgrade for this: firstly because your existing system probably doesn't meet the necessary requirements (e.g. Python >=3.8), and secondly because there have been other major changes to how Netbox is installed, in particular using virtualenv (v2.7.9) and using systemd instead of supervisord (v2.7.0). You must also check all the main release notes for intermediate versions (2.6.0, 2.7.0, 2.8.0 etc) to find out what changes have been made to the data model and REST API. These are not kept backwards compatible between versions, so you'll have to update any integrations you have to match. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for your help! I was able to verify the fix with the latest netbox doker image with JMeter. Each IP was unique and did not throw an error message. We are in a docker environment and the schema has significantly changed. I will find out how to upgrade, but can you please tell us how to set SECRET_KEY in the docker environment? Is Redis mandatory? We just need IPAM functionality. Thank you for your help! |
Beta Was this translation helpful? Give feedback.
The
available-ips
REST API endpoint (and its counterparts) employ a database lock when provisioning new IP addresses, so it's safe to make multiple requests simultaneously.