Skip to content

Commit

Permalink
make "sled failures only" the default policy
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Sep 2, 2024
1 parent 9ca4c5e commit 637b780
Show file tree
Hide file tree
Showing 7 changed files with 498 additions and 8 deletions.
2 changes: 1 addition & 1 deletion nexus/db-model/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl Instance {
ncpus: params.ncpus.into(),
memory: params.memory.into(),
hostname: params.hostname.to_string(),
auto_restart_policy: InstanceAutoRestart::Never,
auto_restart_policy: InstanceAutoRestart::default(),
runtime_state,

updater_gen: Generation::new(),
Expand Down
12 changes: 10 additions & 2 deletions nexus/db-model/src/instance_auto_restart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,26 @@ impl_enum_type!(

// Enum values
Never => b"never"
SledFailuresOnly => b"sled_failures_only"
AllFailures => b"all_failures"
);

impl InstanceAutoRestart {
pub fn label(&self) -> &'static str {
match self {
InstanceAutoRestart::Never => "never",
InstanceAutoRestart::AllFailures => "all_failures",
Self::Never => "never",
Self::SledFailuresOnly => "sled_failures_only",
Self::AllFailures => "all_failures",
}
}
}

impl Default for InstanceAutoRestart {
fn default() -> Self {
Self::SledFailuresOnly
}
}

impl fmt::Display for InstanceAutoRestart {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.label())
Expand Down
Loading

0 comments on commit 637b780

Please sign in to comment.