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
24 changes: 18 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 0 additions & 37 deletions clients/nexus-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
//! Interface for making API requests to the Oxide control plane at large
//! from within the control plane

use iddqd::IdOrdItem;
use iddqd::id_upcast;
use std::collections::HashMap;
use uuid::Uuid;

progenitor::generate_api!(
spec = "../../openapi/nexus-internal.json",
Expand Down Expand Up @@ -38,35 +35,24 @@ progenitor::generate_api!(
BlueprintPhysicalDiskDisposition = nexus_types::deployment::BlueprintPhysicalDiskDisposition,
BlueprintZoneImageSource = nexus_types::deployment::BlueprintZoneImageSource,
Certificate = omicron_common::api::internal::nexus::Certificate,
ClickhouseMode = nexus_types::deployment::ClickhouseMode,
ClickhousePolicy = nexus_types::deployment::ClickhousePolicy,
DatasetKind = omicron_common::api::internal::shared::DatasetKind,
DnsConfigParams = nexus_types::internal_api::params::DnsConfigParams,
DnsConfigZone = nexus_types::internal_api::params::DnsConfigZone,
DnsRecord = nexus_types::internal_api::params::DnsRecord,
Generation = omicron_common::api::external::Generation,
ImportExportPolicy = omicron_common::api::external::ImportExportPolicy,
MacAddr = omicron_common::api::external::MacAddr,
MgsUpdateDriverStatus = nexus_types::internal_api::views::MgsUpdateDriverStatus,
Name = omicron_common::api::external::Name,
NetworkInterface = omicron_common::api::internal::shared::NetworkInterface,
NetworkInterfaceKind = omicron_common::api::internal::shared::NetworkInterfaceKind,
NewPasswordHash = omicron_passwords::NewPasswordHash,
OmicronPhysicalDiskConfig = omicron_common::disk::OmicronPhysicalDiskConfig,
OmicronPhysicalDisksConfig = omicron_common::disk::OmicronPhysicalDisksConfig,
OximeterReadMode = nexus_types::deployment::OximeterReadMode,
OximeterReadPolicy = nexus_types::deployment::OximeterReadPolicy,
PendingMgsUpdate = nexus_types::deployment::PendingMgsUpdate,
PlannerConfig = nexus_types::deployment::PlannerConfig,
ReconfiguratorConfig = nexus_types::deployment::ReconfiguratorConfig,
ReconfiguratorConfigParam = nexus_types::deployment::ReconfiguratorConfigParam,
ReconfiguratorConfigView = nexus_types::deployment::ReconfiguratorConfigView,
RecoverySiloConfig = nexus_sled_agent_shared::recovery_silo::RecoverySiloConfig,
Srv = nexus_types::internal_api::params::Srv,
TypedUuidForBlueprintKind = omicron_uuid_kinds::BlueprintUuid,
TypedUuidForCollectionKind = omicron_uuid_kinds::CollectionUuid,
TypedUuidForDatasetKind = omicron_uuid_kinds::TypedUuid<omicron_uuid_kinds::DatasetKind>,
TypedUuidForDemoSagaKind = omicron_uuid_kinds::DemoSagaUuid,
TypedUuidForDownstairsKind = omicron_uuid_kinds::TypedUuid<omicron_uuid_kinds::DownstairsKind>,
TypedUuidForPhysicalDiskKind = omicron_uuid_kinds::TypedUuid<omicron_uuid_kinds::PhysicalDiskKind>,
TypedUuidForPropolisKind = omicron_uuid_kinds::TypedUuid<omicron_uuid_kinds::PropolisKind>,
Expand All @@ -76,9 +62,6 @@ progenitor::generate_api!(
TypedUuidForUpstairsSessionKind = omicron_uuid_kinds::TypedUuid<omicron_uuid_kinds::UpstairsSessionKind>,
TypedUuidForVolumeKind = omicron_uuid_kinds::TypedUuid<omicron_uuid_kinds::VolumeKind>,
TypedUuidForZpoolKind = omicron_uuid_kinds::TypedUuid<omicron_uuid_kinds::ZpoolKind>,
UpdateStatus = nexus_types::internal_api::views::UpdateStatus,
ZoneStatus = nexus_types::internal_api::views::ZoneStatus,
ZoneStatusVersion = nexus_types::internal_api::views::ZoneStatusVersion,
ZpoolName = omicron_common::zpool_name::ZpoolName,
},
patch = {
Expand All @@ -88,26 +71,6 @@ progenitor::generate_api!(
}
);

impl IdOrdItem for types::PendingSagaInfo {
type Key<'a> = Uuid;

fn key(&self) -> Self::Key<'_> {
self.saga_id
}

id_upcast!();
}

impl IdOrdItem for types::HeldDbClaimInfo {
type Key<'a> = u64;

fn key(&self) -> Self::Key<'_> {
self.id
}

id_upcast!();
}

impl omicron_common::api::external::ClientError for types::Error {
fn message(&self) -> String {
self.message.clone()
Expand Down
6 changes: 6 additions & 0 deletions clients/nexus-lockstep-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ workspace = true
[dependencies]
chrono.workspace = true
futures.workspace = true
iddqd.workspace = true
nexus-types.workspace = true
omicron-common.workspace = true
omicron-uuid-kinds.workspace = true
omicron-workspace-hack.workspace = true
oxnet.workspace = true
progenitor.workspace = true
regress.workspace = true
reqwest.workspace = true
schemars.workspace = true
serde.workspace = true
serde_json.workspace = true
slog.workspace = true
uuid.workspace = true
84 changes: 83 additions & 1 deletion clients/nexus-lockstep-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
//! callers that update in lockstep with Nexus itself (e.g. rack initialization,
//! tests and debugging)

use iddqd::IdOrdItem;
use iddqd::id_upcast;
use uuid::Uuid;

progenitor::generate_api!(
spec = "../../openapi/nexus-lockstep.json",
interface = Positional,
derives = [schemars::JsonSchema],
derives = [schemars::JsonSchema, PartialEq],
inner_type = slog::Logger,
pre_hook = (|log: &slog::Logger, request: &reqwest::Request| {
slog::debug!(log, "client request";
Expand All @@ -21,4 +25,82 @@ progenitor::generate_api!(
post_hook = (|log: &slog::Logger, result: &Result<_, _>| {
slog::debug!(log, "client response"; "result" => ?result);
}),
crates = {
"iddqd" = "*",
"oxnet" = "0.1.0",
},
replace = {
// It's kind of unfortunate to pull in such a complex and unstable type
// as "blueprint" this way, but we have really useful functionality
// (e.g., diff'ing) that's implemented on our local type.
Blueprint = nexus_types::deployment::Blueprint,
BlueprintPhysicalDiskConfig = nexus_types::deployment::BlueprintPhysicalDiskConfig,
BlueprintPhysicalDiskDisposition = nexus_types::deployment::BlueprintPhysicalDiskDisposition,
BlueprintZoneImageSource = nexus_types::deployment::BlueprintZoneImageSource,
ClickhouseMode = nexus_types::deployment::ClickhouseMode,
ClickhousePolicy = nexus_types::deployment::ClickhousePolicy,
DatasetKind = omicron_common::api::internal::shared::DatasetKind,
Generation = omicron_common::api::external::Generation,
MacAddr = omicron_common::api::external::MacAddr,
MgsUpdateDriverStatus = nexus_types::internal_api::views::MgsUpdateDriverStatus,
Name = omicron_common::api::external::Name,
NetworkInterface = omicron_common::api::internal::shared::NetworkInterface,
NetworkInterfaceKind = omicron_common::api::internal::shared::NetworkInterfaceKind,
OmicronPhysicalDiskConfig = omicron_common::disk::OmicronPhysicalDiskConfig,
OmicronPhysicalDisksConfig = omicron_common::disk::OmicronPhysicalDisksConfig,
OximeterReadMode = nexus_types::deployment::OximeterReadMode,
OximeterReadPolicy = nexus_types::deployment::OximeterReadPolicy,
PendingMgsUpdate = nexus_types::deployment::PendingMgsUpdate,
ReconfiguratorConfig = nexus_types::deployment::ReconfiguratorConfig,
ReconfiguratorConfigParam = nexus_types::deployment::ReconfiguratorConfigParam,
ReconfiguratorConfigView = nexus_types::deployment::ReconfiguratorConfigView,
TypedUuidForBlueprintKind = omicron_uuid_kinds::BlueprintUuid,
TypedUuidForDatasetKind = omicron_uuid_kinds::TypedUuid<omicron_uuid_kinds::DatasetKind>,
TypedUuidForDemoSagaKind = omicron_uuid_kinds::DemoSagaUuid,
TypedUuidForPhysicalDiskKind = omicron_uuid_kinds::TypedUuid<omicron_uuid_kinds::PhysicalDiskKind>,
TypedUuidForSledKind = omicron_uuid_kinds::TypedUuid<omicron_uuid_kinds::SledKind>,
TypedUuidForZpoolKind = omicron_uuid_kinds::TypedUuid<omicron_uuid_kinds::ZpoolKind>,
UpdateStatus = nexus_types::internal_api::views::UpdateStatus,
ZoneStatus = nexus_types::internal_api::views::ZoneStatus,
ZoneStatusVersion = nexus_types::internal_api::views::ZoneStatusVersion,
ZpoolName = omicron_common::zpool_name::ZpoolName,
},
patch = {
ByteCount = { derives = [PartialEq, Eq] },
Baseboard = { derives = [PartialEq, Eq] }
}
);

impl IdOrdItem for types::PendingSagaInfo {
type Key<'a> = Uuid;

fn key(&self) -> Self::Key<'_> {
self.saga_id
}

id_upcast!();
}

impl IdOrdItem for types::HeldDbClaimInfo {
type Key<'a> = u64;

fn key(&self) -> Self::Key<'_> {
self.id
}

id_upcast!();
}

impl From<std::time::Duration> for types::Duration {
fn from(s: std::time::Duration) -> Self {
Self { secs: s.as_secs(), nanos: s.subsec_nanos() }
}
}

impl From<types::Duration> for std::time::Duration {
fn from(s: types::Duration) -> Self {
std::time::Duration::from_nanos(
s.secs * 1000000000 + u64::from(s.nanos),
)
}
}
16 changes: 8 additions & 8 deletions dev-tools/omdb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,33 @@ http.workspace = true
humantime.workspace = true
iddqd.workspace = true
indent_write.workspace = true
indicatif.workspace = true
internal-dns-resolver.workspace = true
internal-dns-types.workspace = true
ipnetwork.workspace = true
itertools.workspace = true
nexus-client.workspace = true
multimap.workspace = true
nexus-config.workspace = true
nexus-db-errors.workspace = true
nexus-db-lookup.workspace = true
nexus-db-model.workspace = true
nexus-db-queries.workspace = true
nexus-db-schema.workspace = true
nexus-inventory.workspace = true
nexus-lockstep-client.workspace = true
nexus-reconfigurator-preparation.workspace = true
nexus-saga-recovery.workspace = true
nexus-sled-agent-shared.workspace = true
nexus-types.workspace = true
omicron-common.workspace = true
omicron-uuid-kinds.workspace = true
omicron-workspace-hack.workspace = true
owo-colors.workspace = true
oxide-tokio-rt.workspace = true
oximeter-client.workspace = true
oximeter-db = { workspace = true, default-features = false, features = [ "oxql" ] }
oxnet.workspace = true
petgraph.workspace = true
# See omicron-rpaths for more about the "pq-sys" dependency.
pq-sys = "*"
ratatui.workspace = true
Expand All @@ -79,13 +86,6 @@ unicode-width.workspace = true
update-engine.workspace = true
url.workspace = true
uuid.workspace = true
ipnetwork.workspace = true
omicron-workspace-hack.workspace = true
multimap.workspace = true
indicatif.workspace = true
petgraph.workspace = true
oxnet.workspace = true
owo-colors.workspace = true

[dev-dependencies]
camino-tempfile.workspace = true
Expand Down
20 changes: 10 additions & 10 deletions dev-tools/omdb/src/bin/omdb/db/saga.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ async fn get_saga_sec_status(
}
};

let client = nexus_client::Client::new(
let client = nexus_lockstep_client::Client::new(
&format!("http://[{addr}]:{port}/"),
opctx.log.clone(),
);
Expand All @@ -618,21 +618,21 @@ async fn get_saga_sec_status(
}

Err(e) => match e {
nexus_client::Error::InvalidRequest(_)
| nexus_client::Error::InvalidUpgrade(_)
| nexus_client::Error::ErrorResponse(_)
| nexus_client::Error::ResponseBodyError(_)
| nexus_client::Error::InvalidResponsePayload(_, _)
| nexus_client::Error::UnexpectedResponse(_)
| nexus_client::Error::PreHookError(_)
| nexus_client::Error::PostHookError(_) => {
nexus_lockstep_client::Error::InvalidRequest(_)
| nexus_lockstep_client::Error::InvalidUpgrade(_)
| nexus_lockstep_client::Error::ErrorResponse(_)
| nexus_lockstep_client::Error::ResponseBodyError(_)
| nexus_lockstep_client::Error::InvalidResponsePayload(_, _)
| nexus_lockstep_client::Error::UnexpectedResponse(_)
| nexus_lockstep_client::Error::PreHookError(_)
| nexus_lockstep_client::Error::PostHookError(_) => {
return SagaSecStatus::SecPingError {
sec_id: current_sec,
observed_error: e.to_string(),
};
}

nexus_client::Error::CommunicationError(_) => {
nexus_lockstep_client::Error::CommunicationError(_) => {
// Assume communication error means that it could not be
// contacted.
//
Expand Down
Loading
Loading