Skip to content

Commit

Permalink
move dpd-client dependency out of omicron common
Browse files Browse the repository at this point in the history
This breaks downstreams that import omicron_common as the way dpd-client
gets built is specific to the omicron build machinery.
  • Loading branch information
rcgoodfellow committed May 11, 2024
1 parent c472464 commit da728b2
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 42 deletions.
4 changes: 3 additions & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ http.workspace = true
ipnetwork.workspace = true
macaddr.workspace = true
mg-admin-client.workspace = true
dpd-client.workspace = true
omicron-uuid-kinds.workspace = true
proptest = { workspace = true, optional = true }
rand.workspace = true
Expand Down
33 changes: 0 additions & 33 deletions common/src/api/external/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2894,39 +2894,6 @@ pub struct SwitchPortAddressConfig {
pub interface_name: String,
}

/// Opaque object representing link state. The contents of this object are not
/// yet stable.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct SwitchLinkState {
link: dpd_client::types::Link,
monitors: Option<dpd_client::types::Monitors>,
}

impl SwitchLinkState {
pub fn new(
link: dpd_client::types::Link,
monitors: Option<dpd_client::types::Monitors>,
) -> Self {
Self { link, monitors }
}
}

impl JsonSchema for SwitchLinkState {
fn json_schema(
gen: &mut schemars::gen::SchemaGenerator,
) -> schemars::schema::Schema {
let obj = schemars::schema::Schema::Object(
schemars::schema::SchemaObject::default(),
);
gen.definitions_mut().insert(Self::schema_name(), obj.clone());
obj
}

fn schema_name() -> String {
"SwitchLinkState".to_owned()
}
}

/// The current state of a BGP peer.
#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize, PartialEq)]
#[serde(rename_all = "snake_case")]
Expand Down
2 changes: 1 addition & 1 deletion nexus/src/app/switch_port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

use crate::external_api::params;
use crate::external_api::shared::SwitchLinkState;
use db::datastore::SwitchPortSettingsCombinedResult;
use dpd_client::types::LinkId;
use dpd_client::types::PortId;
Expand All @@ -14,7 +15,6 @@ use nexus_db_queries::db::datastore::UpdatePrecondition;
use nexus_db_queries::db::model::{SwitchPort, SwitchPortSettings};
use nexus_db_queries::db::DataStore;
use omicron_common::api::external::http_pagination::PaginatedBy;
use omicron_common::api::external::SwitchLinkState;
use omicron_common::api::external::SwitchLocation;
use omicron_common::api::external::{
self, CreateResult, DataPageParams, DeleteResult, Error, ListResultVec,
Expand Down
6 changes: 2 additions & 4 deletions nexus/src/external_api/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ use nexus_db_queries::db::lookup::ImageParentLookup;
use nexus_db_queries::db::model::Name;
use nexus_db_queries::{authz, db::datastore::ProbeInfo};
use nexus_types::external_api::shared::BfdStatus;
use omicron_common::api::external::http_pagination::marker_for_name;
use omicron_common::api::external::http_pagination::marker_for_name_or_id;
use omicron_common::api::external::http_pagination::name_or_id_pagination;
use omicron_common::api::external::http_pagination::PaginatedBy;
Expand Down Expand Up @@ -81,9 +82,6 @@ use omicron_common::api::external::VpcFirewallRules;
use omicron_common::api::external::{
http_pagination::data_page_params_for, AggregateBgpMessageHistory,
};
use omicron_common::api::external::{
http_pagination::marker_for_name, SwitchLinkState,
};
use omicron_common::bail_unless;
use omicron_uuid_kinds::GenericUuid;
use parse_display::Display;
Expand Down Expand Up @@ -3438,7 +3436,7 @@ async fn networking_switch_port_status(
rqctx: RequestContext<Arc<ServerContext>>,
path_params: Path<params::SwitchPortPathSelector>,
query_params: Query<params::SwitchPortSelector>,
) -> Result<HttpResponseOk<SwitchLinkState>, HttpError> {
) -> Result<HttpResponseOk<shared::SwitchLinkState>, HttpError> {
let apictx = rqctx.context();
let handler = async {
let nexus = &apictx.nexus;
Expand Down
1 change: 1 addition & 0 deletions nexus/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ anyhow.workspace = true
chrono.workspace = true
clap.workspace = true
base64.workspace = true
dpd-client.workspace = true
futures.workspace = true
humantime.workspace = true
ipnetwork.workspace = true
Expand Down
33 changes: 33 additions & 0 deletions nexus/types/src/external_api/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,39 @@ pub struct BfdStatus {
pub mode: BfdMode,
}

/// Opaque object representing link state. The contents of this object are not
/// yet stable.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct SwitchLinkState {
link: dpd_client::types::Link,
monitors: Option<dpd_client::types::Monitors>,
}

impl SwitchLinkState {
pub fn new(
link: dpd_client::types::Link,
monitors: Option<dpd_client::types::Monitors>,
) -> Self {
Self { link, monitors }
}
}

impl JsonSchema for SwitchLinkState {
fn json_schema(
gen: &mut schemars::gen::SchemaGenerator,
) -> schemars::schema::Schema {
let obj = schemars::schema::Schema::Object(
schemars::schema::SchemaObject::default(),
);
gen.definitions_mut().insert(Self::schema_name(), obj.clone());
obj
}

fn schema_name() -> String {
"SwitchLinkState".to_owned()
}
}

#[cfg(test)]
mod test {
use super::Policy;
Expand Down
8 changes: 6 additions & 2 deletions workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ tokio-postgres = { version = "0.7.10", features = ["with-chrono-0_4", "with-serd
tokio-stream = { version = "0.1.15", features = ["net"] }
tokio-util = { version = "0.7.10", features = ["codec", "io-util"] }
toml = { version = "0.7.8" }
toml_edit = { version = "0.22.12", features = ["serde"] }
toml_edit-3c51e837cfc5589a = { package = "toml_edit", version = "0.22.12", features = ["serde"] }
tracing = { version = "0.1.40", features = ["log"] }
trust-dns-proto = { version = "0.22.0" }
unicode-bidi = { version = "0.3.15" }
Expand Down Expand Up @@ -218,7 +218,7 @@ tokio-postgres = { version = "0.7.10", features = ["with-chrono-0_4", "with-serd
tokio-stream = { version = "0.1.15", features = ["net"] }
tokio-util = { version = "0.7.10", features = ["codec", "io-util"] }
toml = { version = "0.7.8" }
toml_edit = { version = "0.22.12", features = ["serde"] }
toml_edit-3c51e837cfc5589a = { package = "toml_edit", version = "0.22.12", features = ["serde"] }
tracing = { version = "0.1.40", features = ["log"] }
trust-dns-proto = { version = "0.22.0" }
unicode-bidi = { version = "0.3.15" }
Expand Down Expand Up @@ -275,12 +275,16 @@ dof = { version = "0.3.0", default-features = false, features = ["des"] }
mio = { version = "0.8.11", features = ["net", "os-ext"] }
once_cell = { version = "1.19.0" }
rustix = { version = "0.38.31", features = ["fs", "termios"] }
toml_datetime = { version = "0.6.5", default-features = false, features = ["serde"] }
toml_edit-cdcf2f9584511fe6 = { package = "toml_edit", version = "0.19.15", features = ["serde"] }

[target.x86_64-unknown-illumos.build-dependencies]
bitflags-f595c2ba2a3f28df = { package = "bitflags", version = "2.4.2", default-features = false, features = ["std"] }
dof = { version = "0.3.0", default-features = false, features = ["des"] }
mio = { version = "0.8.11", features = ["net", "os-ext"] }
once_cell = { version = "1.19.0" }
rustix = { version = "0.38.31", features = ["fs", "termios"] }
toml_datetime = { version = "0.6.5", default-features = false, features = ["serde"] }
toml_edit-cdcf2f9584511fe6 = { package = "toml_edit", version = "0.19.15", features = ["serde"] }

### END HAKARI SECTION

0 comments on commit da728b2

Please sign in to comment.