Skip to content

Commit 68a8c4b

Browse files
authored
[41/n] be consistent with remove-mupdate-override terminology (#8746)
We now use "remove mupdate override" consistently (other than in the database storage where a migration would be required and we don't support renaming columns or enum values). Closes #8745.
1 parent 65a968e commit 68a8c4b

File tree

15 files changed

+350
-332
lines changed

15 files changed

+350
-332
lines changed

nexus-sled-agent-shared/src/inventory.rs

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ pub struct ConfigReconcilerInventory {
143143
pub orphaned_datasets: IdOrdMap<OrphanedDataset>,
144144
pub zones: BTreeMap<OmicronZoneUuid, ConfigReconcilerInventoryResult>,
145145
pub boot_partitions: BootPartitionContents,
146-
/// The result of clearing the mupdate override field.
146+
/// The result of removing the mupdate override file on disk.
147147
///
148148
/// `None` if `remove_mupdate_override` was not provided in the sled config.
149-
pub clear_mupdate_override: Option<ClearMupdateOverrideInventory>,
149+
pub remove_mupdate_override: Option<RemoveMupdateOverrideInventory>,
150150
}
151151

152152
impl ConfigReconcilerInventory {
@@ -204,16 +204,17 @@ impl ConfigReconcilerInventory {
204204
.iter()
205205
.map(|z| (z.id, ConfigReconcilerInventoryResult::Ok))
206206
.collect();
207-
let clear_mupdate_override = config.remove_mupdate_override.map(|_| {
208-
ClearMupdateOverrideInventory {
209-
boot_disk_result: Ok(
210-
ClearMupdateOverrideBootSuccessInventory::Cleared,
211-
),
212-
non_boot_message: "mupdate override successfully cleared \
207+
let remove_mupdate_override =
208+
config.remove_mupdate_override.map(|_| {
209+
RemoveMupdateOverrideInventory {
210+
boot_disk_result: Ok(
211+
RemoveMupdateOverrideBootSuccessInventory::Removed,
212+
),
213+
non_boot_message: "mupdate override successfully removed \
213214
on non-boot disks"
214-
.to_owned(),
215-
}
216-
});
215+
.to_owned(),
216+
}
217+
});
217218

218219
Self {
219220
last_reconciled_config: config,
@@ -252,7 +253,7 @@ impl ConfigReconcilerInventory {
252253
}),
253254
}
254255
},
255-
clear_mupdate_override,
256+
remove_mupdate_override,
256257
}
257258
}
258259
}
@@ -314,16 +315,16 @@ impl IdOrdItem for OrphanedDataset {
314315
id_upcast!();
315316
}
316317

317-
/// Status of clearing the mupdate override in the inventory.
318+
/// Status of removing the mupdate override in the inventory.
318319
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, JsonSchema, Serialize)]
319-
pub struct ClearMupdateOverrideInventory {
320-
/// The result of clearing the mupdate override on the boot disk.
320+
pub struct RemoveMupdateOverrideInventory {
321+
/// The result of removing the mupdate override on the boot disk.
321322
#[serde(with = "snake_case_result")]
322323
#[schemars(
323-
schema_with = "SnakeCaseResult::<ClearMupdateOverrideBootSuccessInventory, String>::json_schema"
324+
schema_with = "SnakeCaseResult::<RemoveMupdateOverrideBootSuccessInventory, String>::json_schema"
324325
)]
325326
pub boot_disk_result:
326-
Result<ClearMupdateOverrideBootSuccessInventory, String>,
327+
Result<RemoveMupdateOverrideBootSuccessInventory, String>,
327328

328329
/// What happened on non-boot disks.
329330
///
@@ -332,12 +333,12 @@ pub struct ClearMupdateOverrideInventory {
332333
pub non_boot_message: String,
333334
}
334335

335-
/// Status of clearing the mupdate override on the boot disk.
336+
/// Status of removing the mupdate override on the boot disk.
336337
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, JsonSchema, Serialize)]
337338
#[serde(rename_all = "snake_case")]
338-
pub enum ClearMupdateOverrideBootSuccessInventory {
339-
/// The mupdate override was successfully cleared.
340-
Cleared,
339+
pub enum RemoveMupdateOverrideBootSuccessInventory {
340+
/// The mupdate override was successfully removed.
341+
Removed,
341342

342343
/// No mupdate override was found.
343344
///

nexus/db-model/src/inventory.rs

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ use nexus_db_schema::schema::{
4444
};
4545
use nexus_sled_agent_shared::inventory::BootImageHeader;
4646
use nexus_sled_agent_shared::inventory::BootPartitionDetails;
47-
use nexus_sled_agent_shared::inventory::ClearMupdateOverrideBootSuccessInventory;
48-
use nexus_sled_agent_shared::inventory::ClearMupdateOverrideInventory;
4947
use nexus_sled_agent_shared::inventory::ConfigReconcilerInventoryStatus;
5048
use nexus_sled_agent_shared::inventory::HostPhase2DesiredContents;
5149
use nexus_sled_agent_shared::inventory::HostPhase2DesiredSlots;
5250
use nexus_sled_agent_shared::inventory::MupdateOverrideBootInventory;
5351
use nexus_sled_agent_shared::inventory::MupdateOverrideInventory;
5452
use nexus_sled_agent_shared::inventory::MupdateOverrideNonBootInventory;
5553
use nexus_sled_agent_shared::inventory::OrphanedDataset;
54+
use nexus_sled_agent_shared::inventory::RemoveMupdateOverrideBootSuccessInventory;
55+
use nexus_sled_agent_shared::inventory::RemoveMupdateOverrideInventory;
5656
use nexus_sled_agent_shared::inventory::ZoneArtifactInventory;
5757
use nexus_sled_agent_shared::inventory::ZoneImageResolverInventory;
5858
use nexus_sled_agent_shared::inventory::ZoneManifestBootInventory;
@@ -1003,7 +1003,7 @@ pub struct InvSledConfigReconciler {
10031003
pub boot_partition_a_error: Option<String>,
10041004
pub boot_partition_b_error: Option<String>,
10051005
#[diesel(embed)]
1006-
pub clear_mupdate_override: InvClearMupdateOverride,
1006+
pub remove_mupdate_override: InvRemoveMupdateOverride,
10071007
}
10081008

10091009
impl InvSledConfigReconciler {
@@ -1014,7 +1014,7 @@ impl InvSledConfigReconciler {
10141014
boot_disk: Result<M2Slot, String>,
10151015
boot_partition_a_error: Option<String>,
10161016
boot_partition_b_error: Option<String>,
1017-
clear_mupdate_override: InvClearMupdateOverride,
1017+
remove_mupdate_override: InvRemoveMupdateOverride,
10181018
) -> Self {
10191019
// TODO-cleanup We should use `HwM2Slot` instead of integers for this
10201020
// column: https://github.com/oxidecomputer/omicron/issues/8642
@@ -1032,7 +1032,7 @@ impl InvSledConfigReconciler {
10321032
boot_disk_error,
10331033
boot_partition_a_error,
10341034
boot_partition_b_error,
1035-
clear_mupdate_override,
1035+
remove_mupdate_override,
10361036
}
10371037
}
10381038

@@ -1072,48 +1072,50 @@ impl InvSledConfigReconciler {
10721072
}
10731073
}
10741074

1075-
// See [`nexus_sled_agent_shared::inventory::DbClearMupdateOverrideBootSuccess`].
1075+
// See [`nexus_sled_agent_shared::inventory::DbRemoveMupdateOverrideBootSuccess`].
10761076
impl_enum_type!(
1077-
ClearMupdateOverrideBootSuccessEnum:
1077+
RemoveMupdateOverrideBootSuccessEnum:
10781078

10791079
#[derive(Copy, Clone, Debug, AsExpression, FromSqlRow, PartialEq)]
1080-
pub enum DbClearMupdateOverrideBootSuccess;
1080+
pub enum DbRemoveMupdateOverrideBootSuccess;
10811081

10821082
// Enum values
10831083
Cleared => b"cleared"
10841084
NoOverride => b"no-override"
10851085
);
10861086

1087-
impl From<ClearMupdateOverrideBootSuccessInventory>
1088-
for DbClearMupdateOverrideBootSuccess
1087+
impl From<RemoveMupdateOverrideBootSuccessInventory>
1088+
for DbRemoveMupdateOverrideBootSuccess
10891089
{
1090-
fn from(value: ClearMupdateOverrideBootSuccessInventory) -> Self {
1090+
fn from(value: RemoveMupdateOverrideBootSuccessInventory) -> Self {
10911091
match value {
1092-
ClearMupdateOverrideBootSuccessInventory::Cleared => Self::Cleared,
1093-
ClearMupdateOverrideBootSuccessInventory::NoOverride => {
1092+
RemoveMupdateOverrideBootSuccessInventory::Removed => Self::Cleared,
1093+
RemoveMupdateOverrideBootSuccessInventory::NoOverride => {
10941094
Self::NoOverride
10951095
}
10961096
}
10971097
}
10981098
}
10991099

1100-
impl From<DbClearMupdateOverrideBootSuccess>
1101-
for ClearMupdateOverrideBootSuccessInventory
1100+
impl From<DbRemoveMupdateOverrideBootSuccess>
1101+
for RemoveMupdateOverrideBootSuccessInventory
11021102
{
1103-
fn from(value: DbClearMupdateOverrideBootSuccess) -> Self {
1103+
fn from(value: DbRemoveMupdateOverrideBootSuccess) -> Self {
11041104
match value {
1105-
DbClearMupdateOverrideBootSuccess::Cleared => Self::Cleared,
1106-
DbClearMupdateOverrideBootSuccess::NoOverride => Self::NoOverride,
1105+
DbRemoveMupdateOverrideBootSuccess::Cleared => Self::Removed,
1106+
DbRemoveMupdateOverrideBootSuccess::NoOverride => Self::NoOverride,
11071107
}
11081108
}
11091109
}
11101110

1111-
/// See [`nexus_sled_agent_shared::inventory::ClearMupdateOverrideInventory`].
1111+
/// See [`nexus_sled_agent_shared::inventory::RemoveMupdateOverrideInventory`].
11121112
#[derive(Queryable, Clone, Debug, Selectable, Insertable)]
11131113
#[diesel(table_name = inv_sled_config_reconciler)]
1114-
pub struct InvClearMupdateOverride {
1114+
pub struct InvRemoveMupdateOverride {
1115+
// NOTE: the column names start with "clear_" for legacy reasons. Prefer
1116+
// "remove" in the future.
11151117
#[diesel(column_name = clear_mupdate_override_boot_success)]
1116-
pub boot_success: Option<DbClearMupdateOverrideBootSuccess>,
1118+
pub boot_success: Option<DbRemoveMupdateOverrideBootSuccess>,
11171119

11181120
#[diesel(column_name = clear_mupdate_override_boot_error)]
11191121
pub boot_error: Option<String>,
@@ -1122,38 +1124,38 @@ pub struct InvClearMupdateOverride {
11221124
pub non_boot_message: Option<String>,
11231125
}
11241126

1125-
impl InvClearMupdateOverride {
1127+
impl InvRemoveMupdateOverride {
11261128
pub fn new(
1127-
clear_mupdate_override: Option<&ClearMupdateOverrideInventory>,
1129+
remove_mupdate_override: Option<&RemoveMupdateOverrideInventory>,
11281130
) -> Self {
1129-
let boot_success = clear_mupdate_override.and_then(|inv| {
1131+
let boot_success = remove_mupdate_override.and_then(|inv| {
11301132
inv.boot_disk_result.as_ref().ok().map(|v| v.clone().into())
11311133
});
1132-
let boot_error = clear_mupdate_override
1134+
let boot_error = remove_mupdate_override
11331135
.and_then(|inv| inv.boot_disk_result.as_ref().err().cloned());
11341136
let non_boot_message =
1135-
clear_mupdate_override.map(|inv| inv.non_boot_message.clone());
1137+
remove_mupdate_override.map(|inv| inv.non_boot_message.clone());
11361138

11371139
Self { boot_success, boot_error, non_boot_message }
11381140
}
11391141

11401142
pub fn into_inventory(
11411143
self,
1142-
) -> anyhow::Result<Option<ClearMupdateOverrideInventory>> {
1144+
) -> anyhow::Result<Option<RemoveMupdateOverrideInventory>> {
11431145
match self {
11441146
Self {
11451147
boot_success: Some(success),
11461148
boot_error: None,
11471149
non_boot_message: Some(non_boot_message),
1148-
} => Ok(Some(ClearMupdateOverrideInventory {
1150+
} => Ok(Some(RemoveMupdateOverrideInventory {
11491151
boot_disk_result: Ok(success.into()),
11501152
non_boot_message,
11511153
})),
11521154
Self {
11531155
boot_success: None,
11541156
boot_error: Some(boot_error),
11551157
non_boot_message: Some(non_boot_message),
1156-
} => Ok(Some(ClearMupdateOverrideInventory {
1158+
} => Ok(Some(RemoveMupdateOverrideInventory {
11571159
boot_disk_result: Err(boot_error),
11581160
non_boot_message,
11591161
})),

nexus/db-queries/src/db/datastore/inventory.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ use nexus_db_model::{
7373
};
7474
use nexus_db_model::{HwPowerState, InvZoneManifestNonBoot};
7575
use nexus_db_model::{HwRotSlot, InvMupdateOverrideNonBoot};
76-
use nexus_db_model::{InvCaboose, InvClearMupdateOverride};
76+
use nexus_db_model::{InvCaboose, InvRemoveMupdateOverride};
7777
use nexus_db_schema::enums::HwM2SlotEnum;
7878
use nexus_db_schema::enums::HwRotSlotEnum;
7979
use nexus_db_schema::enums::RotImageErrorEnum;
@@ -3789,8 +3789,8 @@ impl DataStore {
37893789
BootPartitionContents { boot_disk, slot_a, slot_b }
37903790
};
37913791

3792-
let clear_mupdate_override = reconciler
3793-
.clear_mupdate_override
3792+
let remove_mupdate_override = reconciler
3793+
.remove_mupdate_override
37943794
.into_inventory()
37953795
.map_err(|err| {
37963796
Error::internal_error(&format!("{err:#}"))
@@ -3812,7 +3812,7 @@ impl DataStore {
38123812
.remove(&sled_id)
38133813
.unwrap_or_default(),
38143814
boot_partitions,
3815-
clear_mupdate_override,
3815+
remove_mupdate_override,
38163816
})
38173817
})
38183818
.transpose()?;
@@ -4036,8 +4036,8 @@ impl ConfigReconcilerRows {
40364036
)?
40374037
};
40384038
last_reconciliation_config_id = Some(last_reconciled_config);
4039-
let clear_mupdate_override = InvClearMupdateOverride::new(
4040-
last_reconciliation.clear_mupdate_override.as_ref(),
4039+
let remove_mupdate_override = InvRemoveMupdateOverride::new(
4040+
last_reconciliation.remove_mupdate_override.as_ref(),
40414041
);
40424042

40434043
self.config_reconcilers.push(InvSledConfigReconciler::new(
@@ -4057,7 +4057,7 @@ impl ConfigReconcilerRows {
40574057
.as_ref()
40584058
.err()
40594059
.cloned(),
4060-
clear_mupdate_override,
4060+
remove_mupdate_override,
40614061
));
40624062

40634063
// Boot partition _errors_ are kept in `InvSledConfigReconciler`
@@ -4310,8 +4310,8 @@ mod test {
43104310
use nexus_sled_agent_shared::inventory::BootPartitionDetails;
43114311
use nexus_sled_agent_shared::inventory::OrphanedDataset;
43124312
use nexus_sled_agent_shared::inventory::{
4313-
BootImageHeader, ClearMupdateOverrideBootSuccessInventory,
4314-
ClearMupdateOverrideInventory,
4313+
BootImageHeader, RemoveMupdateOverrideBootSuccessInventory,
4314+
RemoveMupdateOverrideInventory,
43154315
};
43164316
use nexus_sled_agent_shared::inventory::{
43174317
ConfigReconcilerInventory, ConfigReconcilerInventoryResult,
@@ -5174,10 +5174,10 @@ mod test {
51745174
artifact_size: 456789,
51755175
}),
51765176
},
5177-
clear_mupdate_override: Some(
5178-
ClearMupdateOverrideInventory {
5177+
remove_mupdate_override: Some(
5178+
RemoveMupdateOverrideInventory {
51795179
boot_disk_result: Ok(
5180-
ClearMupdateOverrideBootSuccessInventory::Cleared,
5180+
RemoveMupdateOverrideBootSuccessInventory::Removed,
51815181
),
51825182
non_boot_message: "simulated non-boot message"
51835183
.to_owned(),

nexus/db-schema/src/enums.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ define_enums! {
3333
BpZoneDispositionEnum => "bp_zone_disposition",
3434
BpZoneImageSourceEnum => "bp_zone_image_source",
3535
CabooseWhichEnum => "caboose_which",
36-
ClearMupdateOverrideBootSuccessEnum => "clear_mupdate_override_boot_success",
3736
ClickhouseModeEnum => "clickhouse_mode",
3837
DatasetKindEnum => "dataset_kind",
3938
DnsGroupEnum => "dns_group",
@@ -67,6 +66,9 @@ define_enums! {
6766
RegionReservationPercentEnum => "region_reservation_percent",
6867
RegionSnapshotReplacementStateEnum => "region_snapshot_replacement_state",
6968
RegionSnapshotReplacementStepStateEnum => "region_snapshot_replacement_step_state",
69+
// NOTE: The database enum name starts with "clear_" for legacy reasons.
70+
// Prefer "remove" in the future.
71+
RemoveMupdateOverrideBootSuccessEnum => "clear_mupdate_override_boot_success",
7072
RotImageErrorEnum => "rot_image_error",
7173
RotPageWhichEnum => "root_of_trust_page_which",
7274
RouterRouteKindEnum => "router_route_kind",

nexus/db-schema/src/schema.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,7 @@ table! {
16401640
boot_partition_a_error -> Nullable<Text>,
16411641
boot_partition_b_error -> Nullable<Text>,
16421642

1643-
clear_mupdate_override_boot_success -> Nullable<crate::enums::ClearMupdateOverrideBootSuccessEnum>,
1643+
clear_mupdate_override_boot_success -> Nullable<crate::enums::RemoveMupdateOverrideBootSuccessEnum>,
16441644
clear_mupdate_override_boot_error -> Nullable<Text>,
16451645
clear_mupdate_override_non_boot_message -> Nullable<Text>,
16461646
}

0 commit comments

Comments
 (0)