Skip to content

Commit

Permalink
fix up stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed May 29, 2024
1 parent 7b7dd98 commit 0ac6532
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 22 deletions.
2 changes: 2 additions & 0 deletions nexus/src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ pub struct Nexus {
default_region_allocation_strategy: RegionAllocationStrategy,

/// Channel for notifying background task of change to opte v2p state
#[allow(dead_code)]
// XXX(eliza) do we need this or can we just activate the background task?
v2p_notification_tx: tokio::sync::watch::Sender<()>,
}

Expand Down
18 changes: 1 addition & 17 deletions nexus/src/app/sagas/instance_update/destroyed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,15 @@
use super::ActionRegistry;
use super::NexusActionContext;
use super::NexusSaga;
use super::STATE;
use crate::app::sagas::declare_saga_actions;
use crate::app::sagas::ActionError;
use nexus_db_model::Generation;
use nexus_db_model::Instance;
use nexus_db_model::InstanceRuntimeState;
use nexus_db_model::Vmm;
use nexus_db_queries::authn;
use nexus_db_queries::authz;
use nexus_db_queries::db::datastore::InstanceAndVmms;
use omicron_common::api::external;
use omicron_common::api::external::Error;
use omicron_common::api::external::InstanceState;
use serde::{Deserialize, Serialize};
use slog::info;
use uuid::Uuid;
Expand Down Expand Up @@ -81,7 +77,7 @@ pub(super) struct Params {
}

#[derive(Debug)]
pub(crate) struct SagaVmmDestroyed;
pub(super) struct SagaVmmDestroyed;
impl NexusSaga for SagaVmmDestroyed {
const NAME: &'static str = "instance-update-vmm-destroyed";
type Params = Params;
Expand All @@ -106,18 +102,6 @@ impl NexusSaga for SagaVmmDestroyed {
}
}

fn get_destroyed_vmm(
sagactx: &NexusActionContext,
) -> Result<Option<(Instance, Vmm)>, ActionError> {
let state = sagactx.lookup::<InstanceAndVmms>(STATE)?;
match state.active_vmm {
Some(vmm) if vmm.runtime.state.state() == &InstanceState::Destroyed => {
Ok(Some((state.instance, vmm)))
}
_ => Ok(None),
}
}

async fn siud_release_sled_resources(
sagactx: NexusActionContext,
) -> Result<(), ActionError> {
Expand Down
8 changes: 3 additions & 5 deletions nexus/src/app/sagas/instance_update/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use super::{
use crate::app::db::datastore::InstanceAndVmms;
use crate::app::sagas::declare_saga_actions;
use nexus_db_queries::{authn, authz};
use nexus_types::identity::Resource;
use omicron_common::api::external::InstanceState;
use serde::{Deserialize, Serialize};
use steno::{ActionError, DagBuilder, Node, SagaName};
Expand Down Expand Up @@ -38,7 +37,6 @@ struct RealParams {
}

const INSTANCE_LOCK_ID: &str = "saga_instance_lock_id";
const STATE: &str = "state";

// instance update saga: actions

Expand All @@ -63,7 +61,7 @@ declare_saga_actions! {
// Become the instance updater
BECOME_UPDATER -> "generation" {
+ siu_become_updater
- siu_lock_instance_undo
- siu_unbecome_updater
}

UNLOCK_INSTANCE -> "unlocked" {
Expand All @@ -84,7 +82,7 @@ impl NexusSaga for SagaInstanceUpdate {
}

fn make_saga_dag(
params: &Self::Params,
_params: &Self::Params,
mut builder: DagBuilder,
) -> Result<steno::Dag, super::SagaInitError> {
builder.append(Node::action(
Expand Down Expand Up @@ -214,7 +212,7 @@ async fn siu_fetch_state_and_start_real_saga(
state,
})
.await
.map_err(ActionError::action_failed);
.map_err(ActionError::action_failed)?;

Ok(())
}
Expand Down

0 comments on commit 0ac6532

Please sign in to comment.