Skip to content
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

Add explicit Stopping state (2/3) #1570

Open
wants to merge 5 commits into
base: mkeeter/simplify-faults
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions cmon/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use strum::IntoEnumIterator;
use strum_macros::EnumIter;
use tokio::time::{sleep, Duration};

use crucible::{Arg, DsState};
use crucible::{Arg, ClientStopReason, DsState};

/// Connect to crucible control server
#[derive(Parser, Debug)]
Expand Down Expand Up @@ -87,18 +87,23 @@ enum Action {
// Translate a DsState into a three letter string for printing.
fn short_state(dss: DsState) -> String {
match dss {
DsState::New => "NEW".to_string(),
DsState::New
| DsState::Stopping(ClientStopReason::NegotiationFailed(..)) => {
"NEW".to_string()
}
DsState::WaitActive => "WAC".to_string(),
DsState::WaitQuorum => "WAQ".to_string(),
DsState::Reconcile => "REC".to_string(),
DsState::Active => "ACT".to_string(),
DsState::Faulted => "FLT".to_string(),
DsState::Faulted | DsState::Stopping(ClientStopReason::Fault(..)) => {
"FLT".to_string()
}
DsState::LiveRepairReady => "LRR".to_string(),
DsState::LiveRepair => "LR".to_string(),
DsState::Offline => "OFF".to_string(),
DsState::Deactivated => "DAV".to_string(),
DsState::Disabled => "DIS".to_string(),
DsState::Replacing => "RPC".to_string(),
DsState::Stopping(ClientStopReason::Deactivated) => "DAV".to_string(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed, this DsState change does impact how the dtrace scripts (in tools/dtrace) output looks when we print the generic state. When the final PR from this group lands we will have to update the DTrace scripts so columns align.

DsState::Stopping(ClientStopReason::Disabled) => "DIS".to_string(),
DsState::Stopping(ClientStopReason::Replacing) => "RPC".to_string(),
DsState::Replaced => "RPD".to_string(),
}
}
Expand Down
342 changes: 327 additions & 15 deletions openapi/crucible-control.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,173 @@
"acked"
]
},
"ClientFaultReason": {
"description": "Subset of [`ClientStopReason`] for faulting a client",
"oneOf": [
{
"type": "string",
"enum": [
"requested_fault"
]
},
{
"description": "Received an error from some non-recoverable IO (write or flush)",
"type": "string",
"enum": [
"i_o_error"
]
},
{
"description": "Live-repair failed",
"type": "string",
"enum": [
"failed_live_repair"
]
},
{
"description": "Too many jobs in the queue",
"type": "string",
"enum": [
"too_many_outstanding_jobs"
]
},
{
"description": "Too many bytes in the queue",
"type": "string",
"enum": [
"too_many_outstanding_bytes"
]
},
{
"description": "The upstairs has requested that we deactivate when we were offline",
"type": "string",
"enum": [
"offline_deactivated"
]
},
{
"description": "The Upstairs has dropped jobs that would be needed for replay",
"type": "string",
"enum": [
"ineligible_for_replay"
]
}
]
},
"ClientNegotiationFailed": {
"description": "Subset of [`ClientStopReason`] for faulting a client",
"oneOf": [
{
"description": "Reconcile failed and we're restarting",
"type": "string",
"enum": [
"failed_reconcile"
]
},
{
"description": "Negotiation message received out of order",
"type": "string",
"enum": [
"bad_negotiation_order"
]
},
{
"description": "Negotiation says that we are incompatible",
"type": "string",
"enum": [
"incompatible"
]
}
]
},
"ClientStopReason": {
"description": "When the upstairs halts the IO client task, it must provide a reason",
"oneOf": [
{
"description": "We are about to replace the client task",
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"replacing"
]
}
},
"required": [
"type"
]
},
{
"description": "We have disabled the downstairs client for some reason\n\n(for example, we have received `Message::YouAreNoLongerActive`)",
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"disabled"
]
}
},
"required": [
"type"
]
},
{
"description": "The upstairs has requested that we deactivate",
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"deactivated"
]
}
},
"required": [
"type"
]
},
{
"description": "Something went wrong during negotiation",
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"negotiation_failed"
]
},
"value": {
"$ref": "#/components/schemas/ClientNegotiationFailed"
}
},
"required": [
"type",
"value"
]
},
{
"description": "We have explicitly faulted the client",
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"fault"
]
},
"value": {
"$ref": "#/components/schemas/ClientFaultReason"
}
},
"required": [
"type",
"value"
]
}
]
},
"DownstairsWork": {
"description": "`DownstairsWork` holds the information gathered from the downstairs",
"type": "object",
Expand All @@ -88,21 +255,166 @@
]
},
"DsState": {
"type": "string",
"enum": [
"new",
"wait_active",
"wait_quorum",
"reconcile",
"active",
"faulted",
"live_repair_ready",
"live_repair",
"offline",
"deactivated",
"disabled",
"replacing",
"replaced"
"oneOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"new"
]
}
},
"required": [
"type"
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"wait_active"
]
}
},
"required": [
"type"
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"wait_quorum"
]
}
},
"required": [
"type"
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"reconcile"
]
}
},
"required": [
"type"
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"active"
]
}
},
"required": [
"type"
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"faulted"
]
}
},
"required": [
"type"
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"live_repair_ready"
]
}
},
"required": [
"type"
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"live_repair"
]
}
},
"required": [
"type"
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"offline"
]
}
},
"required": [
"type"
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"replaced"
]
}
},
"required": [
"type"
]
},
{
"description": "The IO task for the client is being stopped",
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"stopping"
]
},
"value": {
"$ref": "#/components/schemas/ClientStopReason"
}
},
"required": [
"type",
"value"
]
}
]
},
"Error": {
Expand Down
Loading