You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reject add sled requests for sleds that already exist (#5675)
I ran into this as a part of #5625, where adding a previously-expunged
sled appeared to succeed, but didn't actually add anything new.
Today if we try to add a sled that is already _running_, we get a 500,
because Nexus fails when it tries to tell the sled-agent to start. But
with this PR, we fail earlier: adding a sled that already has a subnet
allocation fails before we even try to talk to the sled-agent, because
it means someone has already added this sled:
```
root@oxz_switch:~# omdb -w nexus sleds add g2 i86pc
added sled g2 (i86pc): 90413e40-8139-43b4-9081-365dab6e5579
root@oxz_switch:~# omdb -w nexus sleds add g2 i86pc
Error: adding sled
Caused by:
Error Response: status: 400 Bad Request; headers: {"content-type": "application/json", "x-request-id": "9eb95a9f-3fe0-4f75-8846-13490b95500e", "content-length": "188", "date": "Tue, 30 Apr 2024 20:54:49 GMT"}; value: Error { error_code: Some("ObjectAlreadyExists"), message: "already exists: sled \"g2 / i86pc (90413e40-8139-43b4-9081-365dab6e5579)\"", request_id: "9eb95a9f-3fe0-4f75-8846-13490b95500e" }
```
This does change the external API slightly (204 -> 201 created, and we
now return the ID), but I think (?) that's probably fine since we have
no real consumers of that yet.
0 commit comments