Skip to content

Commit

Permalink
Add a migration for last_used_address such that new addresses will
Browse files Browse the repository at this point in the history
start at `SLED_PREFIX + 0xFFFF + 1`.

This still requires testing
  • Loading branch information
andrewjstone committed Jan 8, 2024
1 parent 484b43c commit 51da68f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion nexus/db-model/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use omicron_common::api::external::SemverVersion;
///
/// This should be updated whenever the schema is changed. For more details,
/// refer to: schema/crdb/README.adoc
pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(23, 0, 1);
pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(24, 0, 0);

table! {
disk (id) {
Expand Down
1 change: 0 additions & 1 deletion nexus/db-model/src/sled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ impl SledUpdate {
let last_used_address = {
let mut segments = self.ip().segments();
// We allocate the entire last segment to control plane services
// segments
segments[7] =
omicron_common::address::CP_SERVICES_RESERVED_ADDRESSES;
ipv6::Ipv6Addr::from(Ipv6Addr::from(segments))
Expand Down
3 changes: 3 additions & 0 deletions schema/crdb/24.0.0/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
UPDATE omicron.public.sled
SET last_used_address = (netmask(setmasklen(ip, 64)) & ip) + 0xFFFF
WHERE time_deleted is null;
2 changes: 1 addition & 1 deletion schema/crdb/dbinit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3258,7 +3258,7 @@ INSERT INTO omicron.public.db_metadata (
version,
target_version
) VALUES
( TRUE, NOW(), NOW(), '23.0.1', NULL)
( TRUE, NOW(), NOW(), '24.0.0', NULL)
ON CONFLICT DO NOTHING;

COMMIT;

0 comments on commit 51da68f

Please sign in to comment.