@@ -17,7 +17,7 @@ use crate::sim::simulatable::Simulatable;
1717use crate :: updates:: UpdateManager ;
1818use anyhow:: bail;
1919use anyhow:: Context ;
20- use dropshot:: { HttpError , HttpServer } ;
20+ use dropshot:: HttpError ;
2121use futures:: lock:: Mutex ;
2222use nexus_sled_agent_shared:: inventory:: {
2323 Inventory , InventoryDataset , InventoryDisk , InventoryZpool ,
@@ -43,7 +43,6 @@ use oxnet::Ipv6Net;
4343use propolis_client:: {
4444 types:: VolumeConstructionRequest , Client as PropolisClient ,
4545} ;
46- use propolis_mock_server:: Context as PropolisContext ;
4746use sled_agent_types:: disk:: DiskStateRequested ;
4847use sled_agent_types:: early_networking:: {
4948 EarlyNetworkConfig , EarlyNetworkConfigBody ,
@@ -81,7 +80,7 @@ pub struct SledAgent {
8180 disk_id_to_region_ids : Mutex < HashMap < String , Vec < Uuid > > > ,
8281 pub v2p_mappings : Mutex < HashSet < VirtualNetworkInterfaceHost > > ,
8382 mock_propolis :
84- Mutex < Option < ( HttpServer < Arc < PropolisContext > > , PropolisClient ) > > ,
83+ Mutex < Option < ( propolis_mock_server :: Server , PropolisClient ) > > ,
8584 /// lists of external IPs assigned to instances
8685 pub external_ips :
8786 Mutex < HashMap < PropolisUuid , HashSet < InstanceExternalIpBody > > > ,
@@ -797,26 +796,18 @@ impl SledAgent {
797796 }
798797 let propolis_bind_address =
799798 SocketAddr :: new ( Ipv6Addr :: LOCALHOST . into ( ) , 0 ) ;
800- let dropshot_config = dropshot :: ConfigDropshot {
799+ let dropshot_config = propolis_mock_server :: Config {
801800 bind_address : propolis_bind_address,
802801 ..Default :: default ( )
803802 } ;
804- let propolis_log = log. new ( o ! ( "component" => "propolis-server-mock" ) ) ;
805- let private = Arc :: new ( PropolisContext :: new ( propolis_log) ) ;
806803 info ! ( log, "Starting mock propolis-server..." ) ;
807- let dropshot_log = log. new ( o ! ( "component" => "dropshot" ) ) ;
808- let mock_api = propolis_mock_server:: api ( ) ;
809-
810- let srv = dropshot:: HttpServerStarter :: new (
811- & dropshot_config,
812- mock_api,
813- private,
814- & dropshot_log,
815- )
816- . map_err ( |error| {
817- Error :: unavail ( & format ! ( "initializing propolis-server: {}" , error) )
818- } ) ?
819- . start ( ) ;
804+ let srv = propolis_mock_server:: start ( dropshot_config, log. clone ( ) )
805+ . map_err ( |error| {
806+ Error :: unavail ( & format ! (
807+ "initializing propolis-server: {}" ,
808+ error
809+ ) )
810+ } ) ?;
820811 let addr = srv. local_addr ( ) ;
821812 let client = propolis_client:: Client :: new ( & format ! ( "http://{}" , addr) ) ;
822813 * mock_lock = Some ( ( srv, client) ) ;
0 commit comments