diff --git a/common/src/api/external/mod.rs b/common/src/api/external/mod.rs index b02b577b5b..72ffbbc4b2 100644 --- a/common/src/api/external/mod.rs +++ b/common/src/api/external/mod.rs @@ -2998,7 +2998,8 @@ pub struct SwitchPortRouteConfig { /// over an 802.1Q tagged L2 segment. pub vlan_id: Option, - /// RIB Priority indicating priority within and across protocols. + /// Route RIB priority. Higher priority indicates precedence within and across + /// protocols. pub rib_priority: Option, } diff --git a/nexus/db-model/src/schema_versions.rs b/nexus/db-model/src/schema_versions.rs index 7a67315c41..3fe7a7afb0 100644 --- a/nexus/db-model/src/schema_versions.rs +++ b/nexus/db-model/src/schema_versions.rs @@ -16,7 +16,7 @@ use std::{collections::BTreeMap, sync::LazyLock}; /// /// This must be updated when you change the database schema. Refer to /// schema/crdb/README.adoc in the root of this repository for details. -pub const SCHEMA_VERSION: Version = Version::new(161, 0, 0); +pub const SCHEMA_VERSION: Version = Version::new(162, 0, 0); /// List of all past database schema versions, in *reverse* order /// @@ -28,6 +28,7 @@ static KNOWN_VERSIONS: LazyLock> = LazyLock::new(|| { // | leaving the first copy as an example for the next person. // v // KnownVersion::new(next_int, "unique-dirname-with-the-sql-files"), + KnownVersion::new(162, "route-config-rib-priority"), KnownVersion::new(161, "inv_cockroachdb_status"), KnownVersion::new(160, "tuf-trust-root"), KnownVersion::new(159, "sled-config-desired-host-phase-2"), diff --git a/nexus/db-model/src/switch_port.rs b/nexus/db-model/src/switch_port.rs index b768df6ed7..67b77df937 100644 --- a/nexus/db-model/src/switch_port.rs +++ b/nexus/db-model/src/switch_port.rs @@ -609,7 +609,6 @@ pub struct SwitchPortRouteConfig { pub dst: IpNetwork, pub gw: IpNetwork, pub vid: Option, - #[diesel(column_name = local_pref)] pub rib_priority: Option, } diff --git a/nexus/db-schema/src/schema.rs b/nexus/db-schema/src/schema.rs index 99285a291f..13eccdc6d0 100644 --- a/nexus/db-schema/src/schema.rs +++ b/nexus/db-schema/src/schema.rs @@ -202,7 +202,7 @@ table! { dst -> Inet, gw -> Inet, vid -> Nullable, - local_pref -> Nullable, + rib_priority -> Nullable, } } diff --git a/nexus/types/src/external_api/params.rs b/nexus/types/src/external_api/params.rs index 05e1adc30a..5640227982 100644 --- a/nexus/types/src/external_api/params.rs +++ b/nexus/types/src/external_api/params.rs @@ -2003,8 +2003,8 @@ pub struct Route { /// VLAN id the gateway is reachable over. pub vid: Option, - /// Local preference for route. Higher preference indictes precedence - /// within and across protocols. + /// Route RIB priority. Higher priority indicates precedence within and across + /// protocols. pub rib_priority: Option, } diff --git a/openapi/nexus.json b/openapi/nexus.json index a2aa944bfc..b28fb4627e 100644 --- a/openapi/nexus.json +++ b/openapi/nexus.json @@ -22294,7 +22294,7 @@ }, "rib_priority": { "nullable": true, - "description": "Local preference for route. Higher preference indictes precedence within and across protocols.", + "description": "Route RIB priority. Higher priority indicates precedence within and across protocols.", "type": "integer", "format": "uint8", "minimum": 0 @@ -24570,7 +24570,7 @@ }, "rib_priority": { "nullable": true, - "description": "RIB Priority indicating priority within and across protocols.", + "description": "Route RIB priority. Higher priority indicates precedence within and across protocols.", "type": "integer", "format": "uint8", "minimum": 0 diff --git a/schema/crdb/dbinit.sql b/schema/crdb/dbinit.sql index 39ea3574f1..88914d3926 100644 --- a/schema/crdb/dbinit.sql +++ b/schema/crdb/dbinit.sql @@ -3144,7 +3144,7 @@ CREATE TABLE IF NOT EXISTS omicron.public.switch_port_settings_route_config ( dst INET, gw INET, vid INT4, - local_pref INT8, + rib_priority INT2, /* TODO https://github.com/oxidecomputer/omicron/issues/3013 */ PRIMARY KEY (port_settings_id, interface_name, dst, gw) @@ -6198,7 +6198,7 @@ INSERT INTO omicron.public.db_metadata ( version, target_version ) VALUES - (TRUE, NOW(), NOW(), '161.0.0', NULL) + (TRUE, NOW(), NOW(), '162.0.0', NULL) ON CONFLICT DO NOTHING; COMMIT; diff --git a/schema/crdb/route-config-rib-priority/up01.sql b/schema/crdb/route-config-rib-priority/up01.sql new file mode 100644 index 0000000000..80c6078dce --- /dev/null +++ b/schema/crdb/route-config-rib-priority/up01.sql @@ -0,0 +1 @@ +ALTER TABLE omicron.public.switch_port_settings_route_config ADD COLUMN IF NOT EXISTS rib_priority INT2; diff --git a/schema/crdb/route-config-rib-priority/up02.sql b/schema/crdb/route-config-rib-priority/up02.sql new file mode 100644 index 0000000000..bc79a84229 --- /dev/null +++ b/schema/crdb/route-config-rib-priority/up02.sql @@ -0,0 +1,9 @@ +SET LOCAL disallow_full_table_scans = off; +UPDATE omicron.public.switch_port_settings_route_config +SET rib_priority = + CASE + WHEN local_pref > 255 THEN 255 + WHEN local_pref < 0 THEN 0 + ELSE local_pref::INT2 + END; +SET LOCAL disallow_full_table_scans = on; diff --git a/schema/crdb/route-config-rib-priority/up03.sql b/schema/crdb/route-config-rib-priority/up03.sql new file mode 100644 index 0000000000..e719e0b79b --- /dev/null +++ b/schema/crdb/route-config-rib-priority/up03.sql @@ -0,0 +1 @@ +ALTER TABLE omicron.public.switch_port_settings_route_config DROP COLUMN IF EXISTS local_pref;