Skip to content
Merged
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
75 changes: 74 additions & 1 deletion crucible-client-types/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Oxide Computer Company
// Copyright 2026 Oxide Computer Company

use base64::{Engine, engine};
use schemars::JsonSchema;
Expand Down Expand Up @@ -167,6 +167,79 @@ pub struct RegionExtentInfo {
pub extent_count: u32,
}

/// A tree representation of the info and status of all parts of a Volume.
#[derive(Debug, Serialize, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum VolumeInfo {
Volume {
sub_volumes: Vec<VolumeInfo>,
read_only_parent: Option<Box<VolumeInfo>>,
},

Upstairs {
state: UpstairsInfoStatus,
block_size: Option<u64>,
upstairs_id: Uuid,
session_id: Uuid,
generation: u64,
read_only: bool,
encrypted: bool,
reconcile_in_progress: bool,
live_repair_in_progress: bool,
targets: Vec<DownstairsInfo>,
},
}

#[derive(Debug, Serialize, JsonSchema, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum DownstairsInfoNegotiationStatus {
WaitConnect,
Negotiating,
WaitQuorum,
Reconcile,
LiveRepairReady,
}

#[derive(Debug, Serialize, JsonSchema, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum DownstairsInfoConnectionMode {
New,
Offline,
Faulted,
Replaced,
}

#[derive(Debug, Serialize, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct DownstairsInfo {
pub region_id: Option<Uuid>,
pub target_addr: Option<SocketAddr>,
pub repair_addr: Option<SocketAddr>,
pub state: DownstairsInfoStatus,
}

#[derive(Debug, Serialize, JsonSchema, PartialEq)]
#[serde(rename_all = "snake_case", tag = "type")]
pub enum DownstairsInfoStatus {
Connecting {
state: DownstairsInfoNegotiationStatus,
mode: DownstairsInfoConnectionMode,
},
Active,
LiveRepair,
Stopping,
}

#[derive(Debug, Serialize, JsonSchema, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum UpstairsInfoStatus {
Initializing,
GoActive,
Active,
Deactivating,
Disabled,
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
8 changes: 5 additions & 3 deletions crutest/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright 2023 Oxide Computer Company
// Copyright 2026 Oxide Computer Company

use anyhow::{Result, anyhow, bail};
use bytes::Bytes;
use clap::Parser;
Expand Down Expand Up @@ -32,7 +33,8 @@ mod protocol;
mod stats;
pub use stats::*;

use crucible::volume::{VolumeBuilder, VolumeInfo};
use crucible::volume::VolumeBuilder;
use crucible::volume::VolumeExtentInfo;
use crucible::*;
use crucible_client_types::RegionExtentInfo;
use crucible_protocol::CRUCIBLE_MESSAGE_VERSION;
Expand Down Expand Up @@ -411,7 +413,7 @@ impl BufferbloatConfig {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DiskInfo {
volume_info: VolumeInfo,
volume_info: VolumeExtentInfo,
write_log: WriteLog,
max_block_io: usize,
}
Expand Down
7 changes: 4 additions & 3 deletions crutest/src/protocol.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright 2022 Oxide Computer Company
// Copyright 2026 Oxide Computer Company

use anyhow::bail;
use bytes::{Buf, BufMut, BytesMut};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -39,7 +40,7 @@ pub enum CliMessage {
Flush,
// Run the generic test
Generic(usize, bool, bool),
Info(VolumeInfo),
Info(VolumeExtentInfo),
InfoPlease,
IsActive,
MyUuid(Uuid),
Expand Down Expand Up @@ -221,7 +222,7 @@ mod tests {

#[test]
fn rt_info() -> Result<()> {
let vi = VolumeInfo {
let vi = VolumeExtentInfo {
block_size: 512,
volumes: Vec::new(),
};
Expand Down
Loading