Skip to content

Commit

Permalink
Merge branch 'zpool-in-inventory' into sled-agent-api-to-manage-phys-…
Browse files Browse the repository at this point in the history
…disks
  • Loading branch information
smklein committed Mar 21, 2024
2 parents db34b59 + 3c203c5 commit c213293
Show file tree
Hide file tree
Showing 31 changed files with 1,498 additions and 685 deletions.
18 changes: 11 additions & 7 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,15 @@ omicron-sled-agent = { path = "sled-agent" }
omicron-test-utils = { path = "test-utils" }
omicron-zone-package = "0.11.0"
oxide-client = { path = "clients/oxide-client" }
oxide-vpc = { git = "https://github.com/oxidecomputer/opte", rev = "a4c956e44fc9b75b58b83ad2eec22f6bd9005262", features = [ "api", "std" ] }
oxide-vpc = { git = "https://github.com/oxidecomputer/opte", rev = "7ee353a470ea59529ee1b34729681da887aa88ce", features = [ "api", "std" ] }
once_cell = "1.19.0"
openapi-lint = { git = "https://github.com/oxidecomputer/openapi-lint", branch = "main" }
openapiv3 = "2.0.0"
# must match samael's crate!
openssl = "0.10"
openssl-sys = "0.9"
openssl-probe = "0.1.5"
opte-ioctl = { git = "https://github.com/oxidecomputer/opte", rev = "a4c956e44fc9b75b58b83ad2eec22f6bd9005262" }
opte-ioctl = { git = "https://github.com/oxidecomputer/opte", rev = "7ee353a470ea59529ee1b34729681da887aa88ce" }
oso = "0.27"
owo-colors = "4.0.0"
oximeter = { path = "oximeter/oximeter" }
Expand Down
40 changes: 40 additions & 0 deletions clients/dpd-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

use slog::info;
use slog::Logger;
use types::LinkCreate;
use types::LinkId;
use types::LinkSettings;
use types::PortSettings;

include!(concat!(env!("OUT_DIR"), "/dpd-client.rs"));

Expand Down Expand Up @@ -787,3 +791,39 @@ impl From<u64> for MacAddr {
}
}
}

impl Eq for PortSettings {}

impl PartialEq for PortSettings {
fn eq(&self, other: &Self) -> bool {
self.links == other.links
}
}

impl Eq for LinkSettings {}

impl PartialEq for LinkSettings {
fn eq(&self, other: &Self) -> bool {
self.addrs == other.addrs && self.params == other.params
}
}

impl Eq for LinkCreate {}

impl PartialEq for LinkCreate {
fn eq(&self, other: &Self) -> bool {
self.autoneg == other.autoneg
&& self.fec == other.fec
&& self.kr == other.kr
&& self.lane == other.lane
&& self.speed == other.speed
}
}

impl Eq for LinkId {}

impl PartialEq for LinkId {
fn eq(&self, other: &Self) -> bool {
self.0 == other.0
}
}
46 changes: 46 additions & 0 deletions clients/sled-agent-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ use anyhow::Context;
use async_trait::async_trait;
use omicron_common::api::internal::shared::NetworkInterface;
use std::convert::TryFrom;
use std::hash::Hash;
use std::net::IpAddr;
use std::net::SocketAddr;
use types::{BgpConfig, BgpPeerConfig, PortConfigV1, RouteConfig};
use uuid::Uuid;

progenitor::generate_api!(
Expand Down Expand Up @@ -596,3 +598,47 @@ impl TestInterfaces for Client {
.expect("disk_finish_transition() failed unexpectedly");
}
}

impl Eq for BgpConfig {}

impl Hash for BgpConfig {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.asn.hash(state);
self.originate.hash(state);
}
}

impl Hash for BgpPeerConfig {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.addr.hash(state);
self.asn.hash(state);
self.port.hash(state);
self.hold_time.hash(state);
self.connect_retry.hash(state);
self.delay_open.hash(state);
self.idle_hold_time.hash(state);
self.keepalive.hash(state);
}
}

impl Hash for RouteConfig {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.destination.hash(state);
self.nexthop.hash(state);
}
}

impl Eq for PortConfigV1 {}

impl Hash for PortConfigV1 {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.addresses.hash(state);
self.autoneg.hash(state);
self.bgp_peers.hash(state);
self.port.hash(state);
self.routes.hash(state);
self.switch.hash(state);
self.uplink_port_fec.hash(state);
self.uplink_port_speed.hash(state);
}
}
8 changes: 6 additions & 2 deletions common/src/api/internal/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,9 @@ pub enum ExternalPortDiscovery {
}

/// Switchport Speed options
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, JsonSchema)]
#[derive(
Copy, Clone, Debug, Deserialize, Serialize, PartialEq, JsonSchema, Hash,
)]
#[serde(rename_all = "snake_case")]
pub enum PortSpeed {
#[serde(alias = "0G")]
Expand All @@ -290,7 +292,9 @@ pub enum PortSpeed {
}

/// Switchport FEC options
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, JsonSchema)]
#[derive(
Copy, Clone, Debug, Deserialize, Serialize, PartialEq, JsonSchema, Hash,
)]
#[serde(rename_all = "snake_case")]
pub enum PortFec {
Firecode,
Expand Down
2 changes: 1 addition & 1 deletion dev-tools/omdb/src/bin/omdb/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ impl DbArgs {
/// incompatible because in practice it may well not matter and it's very
/// valuable for this tool to work if it possibly can.
async fn check_schema_version(datastore: &DataStore) {
let expected_version = nexus_db_model::schema::SCHEMA_VERSION;
let expected_version = nexus_db_model::SCHEMA_VERSION;
let version_check = datastore.database_schema_version().await;

match version_check {
Expand Down
4 changes: 4 additions & 0 deletions nexus/db-model/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ omicron-rpaths.workspace = true

[dependencies]
anyhow.workspace = true
camino.workspace = true
chrono.workspace = true
derive-where.workspace = true
diesel = { workspace = true, features = ["postgres", "r2d2", "chrono", "serde_json", "network-address", "uuid"] }
Expand All @@ -17,6 +18,7 @@ ipnetwork.workspace = true
macaddr.workspace = true
newtype_derive.workspace = true
omicron-uuid-kinds.workspace = true
once_cell.workspace = true
parse-display.workspace = true
# See omicron-rpaths for more about the "pq-sys" dependency.
pq-sys = "*"
Expand All @@ -29,6 +31,7 @@ serde_json.workspace = true
steno.workspace = true
strum.workspace = true
thiserror.workspace = true
tokio.workspace = true
uuid.workspace = true

db-macros.workspace = true
Expand All @@ -42,4 +45,5 @@ sled-agent-client.workspace = true
omicron-workspace-hack.workspace = true

[dev-dependencies]
camino-tempfile.workspace = true
expectorate.workspace = true
2 changes: 2 additions & 0 deletions nexus/db-model/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ mod role_assignment;
mod role_builtin;
pub mod saga_types;
pub mod schema;
mod schema_versions;
mod service;
mod service_kind;
mod silo;
Expand Down Expand Up @@ -158,6 +159,7 @@ pub use region::*;
pub use region_snapshot::*;
pub use role_assignment::*;
pub use role_builtin::*;
pub use schema_versions::*;
pub use semver_version::*;
pub use service::*;
pub use service_kind::*;
Expand Down
9 changes: 0 additions & 9 deletions nexus/db-model/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@
//!
//! NOTE: Should be kept up-to-date with dbinit.sql.
use omicron_common::api::external::SemverVersion;

/// The version of the database schema this particular version of Nexus was
/// built against.
///
/// This should be updated whenever the schema is changed. For more details,
/// refer to: schema/crdb/README.adoc
pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(45, 0, 0);

table! {
disk (id) {
id -> Uuid,
Expand Down
Loading

0 comments on commit c213293

Please sign in to comment.