Skip to content

Commit

Permalink
post-rebase updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lif committed Mar 13, 2024
1 parent 4a1b434 commit 29544e2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
19 changes: 18 additions & 1 deletion sled-agent/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1533,6 +1533,7 @@ mod tests {
use super::*;
use crate::fakes::nexus::{FakeNexusServer, ServerContext};
use crate::nexus::NexusClient;
use crate::vmm_reservoir::VmmReservoirManagerHandle;
use crate::zone_bundle::CleanupContext;
use camino_tempfile::Utf8TempDir;
use dns_server::dns_server::ServerHandle as DnsServerHandle;
Expand Down Expand Up @@ -1774,13 +1775,19 @@ mod tests {
nexus_client_with_resolver,
);

let metadata = InstanceMetadata {
silo_id: Uuid::new_v4(),
project_id: Uuid::new_v4(),
};

Instance::new(
logctx.log.new(o!("component" => "Instance")),
id,
propolis_id,
ticket,
initial_state,
services,
metadata,
)
.unwrap()
}
Expand Down Expand Up @@ -1856,7 +1863,7 @@ mod tests {
port_manager,
storage: storage_handle,
zone_bundler,
zone_builder_factory: ZoneBuilderFactory::fake(),
zone_builder_factory: ZoneBuilderFactory::fake(None),
}
}

Expand Down Expand Up @@ -2090,6 +2097,9 @@ mod tests {

let etherstub = Etherstub("mystub".to_string());

let vmm_reservoir_manager =
VmmReservoirManagerHandle::stub_for_test();

let mgr = crate::instance_manager::InstanceManager::new(
logctx.log.new(o!("component" => "InstanceManager")),
nexus_client,
Expand All @@ -2098,6 +2108,7 @@ mod tests {
storage,
zone_bundler,
zone_builder_factory,
vmm_reservoir_manager,
)
.unwrap();

Expand All @@ -2114,13 +2125,19 @@ mod tests {
propolis_addr,
} = fake_instance_initial_state(propolis_id, propolis_addr);

let metadata = InstanceMetadata {
silo_id: Uuid::new_v4(),
project_id: Uuid::new_v4(),
};

mgr.ensure_registered(
instance_id,
propolis_id,
hardware,
instance_runtime,
vmm_runtime,
propolis_addr,
metadata,
)
.await
.unwrap();
Expand Down
13 changes: 13 additions & 0 deletions sled-agent/src/vmm_reservoir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,19 @@ impl VmmReservoirManagerHandle {
}
rx.await.map_err(|_| Error::ReplySenderDropped)?
}

#[cfg(test)]
pub fn stub_for_test() -> Self {
let (tx, _) = flume::bounded(1);
let (size_updated_tx, _) = broadcast::channel(1);
let _manager_handle = Arc::new(thread::spawn(|| {}));
Self {
reservoir_size: Arc::new(AtomicU64::new(0)),
tx,
size_updated_tx,
_manager_handle,
}
}
}

/// Manage the VMM reservoir in a background thread
Expand Down

0 comments on commit 29544e2

Please sign in to comment.