Skip to content

nexus: update switch_port_settings_route_config schema #8587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 18, 2025

Conversation

sudomateo
Copy link
Contributor

I renamed the local_pref column to rib_priority to complete the rename in #6693.

I also changed the type of the renamed column from INT8 to INT2, clamping existing values to 0 or 255. This was missed in #6693 and led to the following error when reading the value from the database.

{"msg":"request completed","v":0,"name":"omicron-dev","level":30,"time":"2025-07-11T13:57:48.670343242Z","hostname":"ms-ox01","pid":3113,"uri":"/v1/system/networking/switch-port-settings","method":"POST","req_id":"12b35f5a-2255-4244-a5aa-f9c84032fb81","remote_addr":"127.0.0.1:41766","local_addr":"127.0.0.1:12220","component":"dropshot_external","name":"e6bff1ff-24fb-49dc-a54e-c6a350cd4d6c","error_message_external":"Internal Server Error","error_message_internal":"Unknown diesel error creating SwitchPortSettings called \"example\": Error deserializing field 'local_pref': Received more than 2 bytes while decoding an i16. Was an Integer expression accidentally marked as SmallInt?","latency_us":133766,"response_code":500}

The error occurred because the Rust type was SqlU8 and the database type was INT8. Reads would fail because INT8 columns could not be read into SqlU8 types without loss of precision.

This was caught in
oxidecomputer/terraform-provider-oxide#426 when implementing a Terraform provider resource for switch port settings. It's likely that this has been broken since #6693 and any user that attempted to set rib_priority in their Rack Setup Service (RSS) would have encountered this error. However, rib_priority is an uncommon configuration option and none of our customer's RSS configurations show this as being set.

Given this information, it seems safe to assume that no customer has the rib_priority column set so the clamping logic implemented here should work well for customer installations.

@sudomateo sudomateo force-pushed the sudomateo/wuxkwlxksyvk branch from b40fcbd to 75d9f46 Compare July 12, 2025 18:11
I renamed the `local_pref` column to `rib_priority` to complete the
rename in #6693.

I also changed the type of the renamed column from `INT8` to
`INT2`, clamping existing values to `0` or `255`. This was missed
in #6693 and led to the
following error when reading the value from the database.

```
{"msg":"request completed","v":0,"name":"omicron-dev","level":30,"time":"2025-07-11T13:57:48.670343242Z","hostname":"ms-ox01","pid":3113,"uri":"/v1/system/networking/switch-port-settings","method":"POST","req_id":"12b35f5a-2255-4244-a5aa-f9c84032fb81","remote_addr":"127.0.0.1:41766","local_addr":"127.0.0.1:12220","component":"dropshot_external","name":"e6bff1ff-24fb-49dc-a54e-c6a350cd4d6c","error_message_external":"Internal Server Error","error_message_internal":"Unknown diesel error creating SwitchPortSettings called \"example\": Error deserializing field 'local_pref': Received more than 2 bytes while decoding an i16. Was an Integer expression accidentally marked as SmallInt?","latency_us":133766,"response_code":500}
```

The error occurred because the Rust type was `SqlU8` and the database
type was `INT8`. Reads would fail because `INT8` columns could not be
read into `SqlU8` types without loss of precision.

This was caught in
oxidecomputer/terraform-provider-oxide#426
when implementing a Terraform provider resource for switch
port settings. It's likely that this has been broken since
#6693 and any user that
attempted to set `rib_priority` in their Rack Setup Service (RSS) would
have encountered this error. However, `rib_priority` is an uncommon
configuration option and none of our customer's RSS configurations show
this as being set.

Given this information, it seems safe to assume that no customer has the
`rib_priority` column set so the clamping logic implemented here should
work well for customer installations.
@sudomateo sudomateo force-pushed the sudomateo/wuxkwlxksyvk branch from 75d9f46 to 17dda23 Compare July 17, 2025 20:10
@sudomateo sudomateo enabled auto-merge (squash) July 17, 2025 21:05
@sudomateo sudomateo merged commit dd422b1 into main Jul 18, 2025
17 checks passed
@sudomateo sudomateo deleted the sudomateo/wuxkwlxksyvk branch July 18, 2025 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rib_priority needs additional validation / better error handling
2 participants