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

Upstairs state machine refactoring (3/3) #1577

Open
wants to merge 21 commits into
base: mkeeter/explicit-stop-state
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .github/buildomat/jobs/test-ds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ for t in "$input/bins/"*.gz; do
done

export BINDIR=/var/tmp/bins
export RUST_BACKTRACE=1

banner test_ds
ptime -m bash "$input/scripts/test_ds.sh"
Expand Down
1 change: 1 addition & 0 deletions .github/buildomat/jobs/test-live-repair.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ for t in "$input/bins/"*.gz; do
done

export BINDIR=/var/tmp/bins
export RUST_BACKTRACE=1

echo "BINDIR is $BINDIR"
echo "bindir contains:"
Expand Down
1 change: 1 addition & 0 deletions .github/buildomat/jobs/test-memory.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ for t in "$input/rbins/"*.gz; do
done

export BINDIR=/var/tmp/bins
export RUST_BACKTRACE=1

banner setup
pfexec plimit -n 9123456 $$
Expand Down
1 change: 1 addition & 0 deletions .github/buildomat/jobs/test-region-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ for t in "$input/rbins/"*.gz; do
done

export BINDIR=/var/tmp/bins
export RUST_BACKTRACE=1

banner region
pfexec plimit -n 9123456 $$
Expand Down
1 change: 1 addition & 0 deletions .github/buildomat/jobs/test-repair.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ for t in "$input/bins/"*.gz; do
done

export BINDIR=/var/tmp/bins
export RUST_BACKTRACE=1

echo "Setup self timeout"
# Give this test two hours to finish
Expand Down
1 change: 1 addition & 0 deletions .github/buildomat/jobs/test-replay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ for t in "$input/bins/"*.gz; do
done

export BINDIR=/var/tmp/bins
export RUST_BACKTRACE=1
banner setup

echo "Setup self timeout"
Expand Down
1 change: 1 addition & 0 deletions .github/buildomat/jobs/test-up-encrypted.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ for t in "$input/bins/"*.gz; do
done

export BINDIR=/var/tmp/bins
export RUST_BACKTRACE=1

# Give this test one hour to finish
jobpid=$$; (sleep $(( 60 * 60 )); banner fail-timeout; ps -ef; zfs list;kill $jobpid) &
Expand Down
1 change: 1 addition & 0 deletions .github/buildomat/jobs/test-up-unencrypted.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ for t in "$input/bins/"*.gz; do
done

export BINDIR=/var/tmp/bins
export RUST_BACKTRACE=1

# Give this test two hours to finish
jobpid=$$; (sleep $(( 120 * 60 )); banner fail-timeout; ps -ef; zfs list;kill $jobpid) &
Expand Down
52 changes: 38 additions & 14 deletions cmon/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ use strum::IntoEnumIterator;
use strum_macros::EnumIter;
use tokio::time::{sleep, Duration};

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

/// Connect to crucible control server
#[derive(Parser, Debug)]
Expand Down Expand Up @@ -87,24 +89,46 @@ enum Action {
// Translate a DsState into a three letter string for printing.
fn short_state(dss: DsState) -> String {
match dss {
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::Connecting {
Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking about how to present this, but what you have done here is fine for now and if I come up with something I like better, I'll put out a PR for it

state: NegotiationState::WaitActive,
..
} => "WAC".to_string(),

DsState::Connecting {
state: NegotiationState::WaitQuorum,
..
} => "WAQ".to_string(),
DsState::Connecting {
state: NegotiationState::Reconcile,
..
} => "REC".to_string(),
DsState::Active => "ACT".to_string(),
DsState::Faulted | DsState::Stopping(ClientStopReason::Fault(..)) => {
"FLT".to_string()
DsState::Connecting {
state: NegotiationState::LiveRepairReady,
..
} => "LRR".to_string(),
DsState::Stopping(ClientStopReason::NegotiationFailed(..))
| DsState::Connecting {
mode: ConnectionMode::New,
..
} => "NEW".to_string(),
DsState::Connecting {
mode: ConnectionMode::Faulted,
..
}
DsState::LiveRepairReady => "LRR".to_string(),
| DsState::Stopping(ClientStopReason::Fault(..)) => "FLT".to_string(),
DsState::LiveRepair => "LR".to_string(),
DsState::Offline => "OFF".to_string(),
DsState::Connecting {
mode: ConnectionMode::Offline,
..
} => "OFF".to_string(),
DsState::Stopping(ClientStopReason::Deactivated) => "DAV".to_string(),
DsState::Stopping(ClientStopReason::Disabled) => "DIS".to_string(),
DsState::Stopping(ClientStopReason::Replacing) => "RPC".to_string(),
DsState::Replaced => "RPD".to_string(),
DsState::Stopping(ClientStopReason::Replacing)
| DsState::Connecting {
mode: ConnectionMode::Replaced,
..
} => "RPD".to_string(),
}
}

Expand Down
Loading