Skip to content

Commit

Permalink
wip dead code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed May 28, 2024
1 parent 575435e commit f316596
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 60 deletions.
8 changes: 7 additions & 1 deletion nexus/src/app/background/instance_watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use nexus_db_queries::db::pagination::Paginator;
use nexus_db_queries::db::DataStore;
use nexus_types::identity::Asset;
use nexus_types::identity::Resource;
use omicron_common::api::external::Error;
use omicron_common::api::external::InstanceState;
use omicron_common::api::internal::nexus::SledInstanceState;
use oximeter::types::ProducerRegistry;
Expand Down Expand Up @@ -166,7 +167,12 @@ impl InstanceWatcher {
"error updating instance";
"error" => ?e,
);
Incomplete::UpdateFailed
match e {
Error::ObjectNotFound { .. } => {
Incomplete::InstanceNotFound
}
_ => Incomplete::UpdateFailed,
}
})
.map(|updated| {
slog::debug!(
Expand Down
44 changes: 1 addition & 43 deletions nexus/src/app/instance_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,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...
#[allow(dead_code)] // TODO(eliza): this probably needs to be deleted eventually
pub(crate) async fn ensure_updated_instance_network_config(
datastore: &DataStore,
log: &slog::Logger,
Expand Down Expand Up @@ -687,49 +688,6 @@ pub(crate) async fn probe_ensure_dpd_config(
Ok(())
}

/// Deletes an instance's OPTE V2P mappings and the boundary switch NAT
/// entries for its external IPs.
///
/// This routine returns immediately upon encountering any errors (and will
/// not try to destroy any more objects after the point of failure).
async fn clear_instance_networking_state(
datastore: &DataStore,
log: &slog::Logger,
resolver: &internal_dns::resolver::Resolver,
opctx: &OpContext,
opctx_alloc: &OpContext,
authz_instance: &authz::Instance,
v2p_notification_tx: tokio::sync::watch::Sender<()>,
) -> Result<(), Error> {
if let Err(e) = v2p_notification_tx.send(()) {
error!(
log,
"error notifying background task of v2p change";
"error" => ?e
)
};

instance_delete_dpd_config(
datastore,
log,
resolver,
opctx,
opctx_alloc,
authz_instance,
)
.await?;

notify_dendrite_nat_state(
datastore,
log,
resolver,
opctx_alloc,
Some(authz_instance.id()),
true,
)
.await
}

/// Attempts to delete all of the Dendrite NAT configuration for the
/// instance identified by `authz_instance`.
///
Expand Down
17 changes: 1 addition & 16 deletions sled-agent/src/common/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ use crate::params::InstanceMigrationSourceParams;
use chrono::{DateTime, Utc};
use omicron_common::api::external::InstanceState as ApiInstanceState;
use omicron_common::api::internal::nexus::{
InstanceRuntimeState, SledInstanceState, VmmRuntimeState,
SledInstanceState, VmmRuntimeState,
};
use propolis_client::types::{
InstanceState as PropolisApiState, InstanceStateMonitorResponse,
MigrationState,
};
use uuid::Uuid;

Expand Down Expand Up @@ -129,20 +128,6 @@ impl From<PublishedVmmState> for ApiInstanceState {
}
}

/// The possible roles a VMM can have vis-a-vis an instance.
#[derive(Clone, Copy, Debug, PartialEq)]
enum PropolisRole {
/// The VMM is its instance's current active VMM.
Active,

/// The VMM is its instance's migration target VMM.
MigrationTarget,

/// The instance does not refer to this VMM (but it may have done so in the
/// past).
Retired,
}

/// Action to be taken on behalf of state transition.
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Action {
Expand Down

0 comments on commit f316596

Please sign in to comment.