Skip to content

Commit

Permalink
clippy cleanliness/unused methods
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Apr 25, 2024
1 parent 13bd8f9 commit 503ad20
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 125 deletions.
71 changes: 6 additions & 65 deletions nexus/src/app/instance_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,35 +211,13 @@ impl super::Nexus {
opctx: &OpContext,
nat_entry: &Ipv4NatEntry,
) -> Result<(), Error> {
let log = &self.log;

info!(log, "deleting individual NAT entry from dpd configuration";
"id" => ?nat_entry.id,
"version_added" => %nat_entry.external_address.0);

match self.db_datastore.ipv4_nat_delete(&opctx, nat_entry).await {
Ok(_) => {}
Err(err) => match err {
Error::ObjectNotFound { .. } => {
warn!(log, "no matching nat entries to soft delete");
}
_ => {
let message = format!(
"failed to delete nat entry due to error: {err:?}"
);
error!(log, "{}", message);
return Err(Error::internal_error(&message));
}
},
}

notify_dendrite_nat_state(
delete_dpd_config_by_entry(
&self.db_datastore,
log,
&self.resolver().await,
&self.log,
opctx,
&self.opctx_alloc,
None,
false,
nat_entry,
)
.await
}
Expand All @@ -263,45 +241,6 @@ impl super::Nexus {
)
.await
}

/// Given old and new instance runtime states, determines the desired
/// networking configuration for a given instance and ensures it has been
/// propagated to all relevant sleds.
///
/// # Arguments
///
/// - opctx: An operation context for this operation.
/// - authz_instance: A resolved authorization context for the instance of
/// interest.
/// - prev_instance_state: The most-recently-recorded instance runtime
/// state for this instance.
/// - new_instance_state: The instance state that the caller of this routine
/// has observed and that should be used to set up this instance's
/// networking state.
///
/// # Return value
///
/// `Ok(())` if this routine completed all the operations it wanted to
/// complete, or an appropriate `Err` otherwise.
pub(crate) async fn ensure_updated_instance_network_config(
&self,
opctx: &OpContext,
authz_instance: &authz::Instance,
prev_instance_state: &db::model::InstanceRuntimeState,
new_instance_state: &nexus::InstanceRuntimeState,
) -> Result<(), Error> {
ensure_updated_instance_network_config(
&self.db_datastore,
&self.log,
&self.resolver().await,
opctx,
&self.opctx_alloc,
authz_instance,
prev_instance_state,
new_instance_state,
)
.await
}
}

/// Returns the set of switches with uplinks configured and boundary
Expand Down Expand Up @@ -353,6 +292,7 @@ pub(crate) async fn boundary_switches(
///
/// `Ok(())` if this routine completed all the operations it wanted to
/// complete, or an appropriate `Err` otherwise.
#[allow(clippy::too_many_arguments)] // Yeah, I know, I know, Clippy...
pub(crate) async fn ensure_updated_instance_network_config(
datastore: &DataStore,
log: &slog::Logger,
Expand Down Expand Up @@ -529,6 +469,7 @@ pub(crate) async fn ensure_updated_instance_network_config(
/// - If this is `None`, this routine configures DPD for all external
/// IPs and *will back out* if any IPs are not yet fully attached to
/// the instance.
#[allow(clippy::too_many_arguments)] // I don't like it either, clippy...
pub(crate) async fn instance_ensure_dpd_config(
datastore: &DataStore,
log: &slog::Logger,
Expand Down
53 changes: 0 additions & 53 deletions nexus/src/app/oximeter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,59 +163,6 @@ impl super::Nexus {
Ok(())
}

/// Idempotently un-assign a producer from an oximeter collector.
pub(crate) async fn unassign_producer(
&self,
opctx: &OpContext,
id: &Uuid,
) -> Result<(), Error> {
if let Some(collector_id) =
self.db_datastore.producer_endpoint_delete(opctx, id).await?
{
debug!(
self.log,
"deleted metric producer assignment";
"producer_id" => %id,
"collector_id" => %collector_id,
);
let oximeter_info =
self.db_datastore.oximeter_lookup(opctx, &collector_id).await?;
let address =
SocketAddr::new(oximeter_info.ip.ip(), *oximeter_info.port);
let client = build_oximeter_client(&self.log, &id, address);
if let Err(e) = client.producer_delete(&id).await {
error!(
self.log,
"failed to delete producer from collector";
"producer_id" => %id,
"collector_id" => %collector_id,
"address" => %address,
"error" => ?e,
);
return Err(Error::internal_error(
format!("failed to delete producer from collector: {e:?}")
.as_str(),
));
} else {
debug!(
self.log,
"successfully deleted producer from collector";
"producer_id" => %id,
"collector_id" => %collector_id,
"address" => %address,
);
Ok(())
}
} else {
trace!(
self.log,
"un-assigned non-existent metric producer";
"producer_id" => %id,
);
Ok(())
}
}

/// Returns a results from the timeseries DB based on the provided query
/// parameters.
///
Expand Down
7 changes: 0 additions & 7 deletions nexus/src/app/switch_port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,6 @@ impl super::Nexus {
self.db_datastore.switch_port_list(opctx, pagparams).await
}

pub(crate) async fn list_switch_ports_with_uplinks(
&self,
opctx: &OpContext,
) -> ListResultVec<SwitchPort> {
list_switch_ports_with_uplinks(&self.db_datastore, opctx).await
}

pub(crate) async fn set_switch_port_settings_id(
&self,
opctx: &OpContext,
Expand Down

0 comments on commit 503ad20

Please sign in to comment.