@@ -1425,6 +1425,55 @@ impl ServiceManager {
1425
1425
. install ( )
1426
1426
. await ?;
1427
1427
1428
+ let running_zone = match & request {
1429
+ ZoneArgs :: Omicron ( config) => {
1430
+ self . boot_omicron_zone ( config, installed_zone) . await ?
1431
+ }
1432
+ ZoneArgs :: Switch ( config) => {
1433
+ self . boot_switch_zone (
1434
+ config,
1435
+ installed_zone,
1436
+ & links_need_link_local,
1437
+ bootstrap_name_and_address,
1438
+ & device_names,
1439
+ )
1440
+ . await ?
1441
+ }
1442
+ } ;
1443
+
1444
+ // Now that we've booted the zone, we'll notify the sled-agent about:
1445
+ //
1446
+ // - Its control VNIC (all zones have one)
1447
+ // - Any bootstrap network VNIC (only the switch zone has one)
1448
+ // - Any OPTE ports (instance zones, or Oxide zones with external
1449
+ // connectivity).
1450
+ //
1451
+ // Note that we'll almost always have started the sled-agent at this
1452
+ // point. The only exception is the switch zone, during bootstrapping
1453
+ // but before we've either run RSS or unlocked the rack. In both those
1454
+ // cases, we have a `StartSledAgentRequest`, and so a metrics queue.
1455
+ if let Some ( queue) = self . maybe_metrics_queue ( ) {
1456
+ match queue. track_zone_links ( & running_zone) {
1457
+ Ok ( _) => debug ! ( self . inner. log, "Tracking zone datalinks" ) ,
1458
+ Err ( errors) => {
1459
+ error ! (
1460
+ self . inner. log,
1461
+ "Failed to track one or more links in the zone, \
1462
+ some metrics will not be produced";
1463
+ "zone_name" => running_zone. name( ) ,
1464
+ "errors" => ?errors,
1465
+ ) ;
1466
+ }
1467
+ }
1468
+ }
1469
+ Ok ( running_zone)
1470
+ }
1471
+
1472
+ async fn boot_omicron_zone (
1473
+ & self ,
1474
+ config : & OmicronZoneConfig ,
1475
+ installed_zone : InstalledZone ,
1476
+ ) -> Result < RunningZone , Error > {
1428
1477
let disabled_ssh_service = ServiceBuilder :: new ( "network/ssh" )
1429
1478
. add_instance ( ServiceInstanceBuilder :: new ( "default" ) . disable ( ) ) ;
1430
1479
@@ -1436,11 +1485,11 @@ impl ServiceManager {
1436
1485
ServiceBuilder :: new ( "network/dns/client" )
1437
1486
. add_instance ( ServiceInstanceBuilder :: new ( "default" ) ) ;
1438
1487
1439
- let running_zone = match & request {
1440
- ZoneArgs :: Omicron ( OmicronZoneConfig {
1488
+ let running_zone = match config {
1489
+ OmicronZoneConfig {
1441
1490
zone_type : OmicronZoneType :: Clickhouse { address, .. } ,
1442
1491
..
1443
- } ) => {
1492
+ } => {
1444
1493
let Some ( info) = self . inner . sled_info . get ( ) else {
1445
1494
return Err ( Error :: SledAgentNotReady ) ;
1446
1495
} ;
@@ -1522,10 +1571,10 @@ impl ServiceManager {
1522
1571
RunningZone :: boot ( installed_zone) . await ?
1523
1572
}
1524
1573
1525
- ZoneArgs :: Omicron ( OmicronZoneConfig {
1574
+ OmicronZoneConfig {
1526
1575
zone_type : OmicronZoneType :: ClickhouseServer { address, .. } ,
1527
1576
..
1528
- } ) => {
1577
+ } => {
1529
1578
let Some ( info) = self . inner . sled_info . get ( ) else {
1530
1579
return Err ( Error :: SledAgentNotReady ) ;
1531
1580
} ;
@@ -1607,10 +1656,10 @@ impl ServiceManager {
1607
1656
RunningZone :: boot ( installed_zone) . await ?
1608
1657
}
1609
1658
1610
- ZoneArgs :: Omicron ( OmicronZoneConfig {
1659
+ OmicronZoneConfig {
1611
1660
zone_type : OmicronZoneType :: ClickhouseKeeper { address, .. } ,
1612
1661
..
1613
- } ) => {
1662
+ } => {
1614
1663
let Some ( info) = self . inner . sled_info . get ( ) else {
1615
1664
return Err ( Error :: SledAgentNotReady ) ;
1616
1665
} ;
@@ -1685,11 +1734,11 @@ impl ServiceManager {
1685
1734
RunningZone :: boot ( installed_zone) . await ?
1686
1735
}
1687
1736
1688
- ZoneArgs :: Omicron ( OmicronZoneConfig {
1737
+ OmicronZoneConfig {
1689
1738
id : zone_id,
1690
1739
zone_type : OmicronZoneType :: CockroachDb { address, .. } ,
1691
1740
..
1692
- } ) => {
1741
+ } => {
1693
1742
let Some ( info) = self . inner . sled_info . get ( ) else {
1694
1743
return Err ( Error :: SledAgentNotReady ) ;
1695
1744
} ;
@@ -1761,10 +1810,10 @@ impl ServiceManager {
1761
1810
RunningZone :: boot ( installed_zone) . await ?
1762
1811
}
1763
1812
1764
- ZoneArgs :: Omicron ( OmicronZoneConfig {
1813
+ OmicronZoneConfig {
1765
1814
zone_type : OmicronZoneType :: Crucible { address, dataset } ,
1766
1815
..
1767
- } ) => {
1816
+ } => {
1768
1817
let Some ( info) = self . inner . sled_info . get ( ) else {
1769
1818
return Err ( Error :: SledAgentNotReady ) ;
1770
1819
} ;
@@ -1814,10 +1863,10 @@ impl ServiceManager {
1814
1863
RunningZone :: boot ( installed_zone) . await ?
1815
1864
}
1816
1865
1817
- ZoneArgs :: Omicron ( OmicronZoneConfig {
1866
+ OmicronZoneConfig {
1818
1867
zone_type : OmicronZoneType :: CruciblePantry { address } ,
1819
1868
..
1820
- } ) => {
1869
+ } => {
1821
1870
let Some ( info) = self . inner . sled_info . get ( ) else {
1822
1871
return Err ( Error :: SledAgentNotReady ) ;
1823
1872
} ;
@@ -1857,11 +1906,11 @@ impl ServiceManager {
1857
1906
. map_err ( |err| Error :: io ( "crucible pantry profile" , err) ) ?;
1858
1907
RunningZone :: boot ( installed_zone) . await ?
1859
1908
}
1860
- ZoneArgs :: Omicron ( OmicronZoneConfig {
1909
+ OmicronZoneConfig {
1861
1910
id,
1862
1911
zone_type : OmicronZoneType :: Oximeter { address } ,
1863
1912
..
1864
- } ) => {
1913
+ } => {
1865
1914
let Some ( info) = self . inner . sled_info . get ( ) else {
1866
1915
return Err ( Error :: SledAgentNotReady ) ;
1867
1916
} ;
@@ -1894,7 +1943,7 @@ impl ServiceManager {
1894
1943
} ) ?;
1895
1944
RunningZone :: boot ( installed_zone) . await ?
1896
1945
}
1897
- ZoneArgs :: Omicron ( OmicronZoneConfig {
1946
+ OmicronZoneConfig {
1898
1947
zone_type :
1899
1948
OmicronZoneType :: ExternalDns {
1900
1949
http_address,
@@ -1903,7 +1952,7 @@ impl ServiceManager {
1903
1952
..
1904
1953
} ,
1905
1954
..
1906
- } ) => {
1955
+ } => {
1907
1956
let Some ( info) = self . inner . sled_info . get ( ) else {
1908
1957
return Err ( Error :: SledAgentNotReady ) ;
1909
1958
} ;
@@ -1953,7 +2002,7 @@ impl ServiceManager {
1953
2002
} ) ?;
1954
2003
RunningZone :: boot ( installed_zone) . await ?
1955
2004
}
1956
- ZoneArgs :: Omicron ( OmicronZoneConfig {
2005
+ OmicronZoneConfig {
1957
2006
zone_type :
1958
2007
OmicronZoneType :: BoundaryNtp {
1959
2008
address,
@@ -1963,7 +2012,7 @@ impl ServiceManager {
1963
2012
..
1964
2013
} ,
1965
2014
..
1966
- } ) => {
2015
+ } => {
1967
2016
let Some ( info) = self . inner . sled_info . get ( ) else {
1968
2017
return Err ( Error :: SledAgentNotReady ) ;
1969
2018
} ;
@@ -2057,10 +2106,10 @@ impl ServiceManager {
2057
2106
2058
2107
RunningZone :: boot ( installed_zone) . await ?
2059
2108
}
2060
- ZoneArgs :: Omicron ( OmicronZoneConfig {
2109
+ OmicronZoneConfig {
2061
2110
zone_type : OmicronZoneType :: InternalNtp { address } ,
2062
2111
..
2063
- } ) => {
2112
+ } => {
2064
2113
let Some ( info) = self . inner . sled_info . get ( ) else {
2065
2114
return Err ( Error :: SledAgentNotReady ) ;
2066
2115
} ;
@@ -2134,7 +2183,7 @@ impl ServiceManager {
2134
2183
2135
2184
RunningZone :: boot ( installed_zone) . await ?
2136
2185
}
2137
- ZoneArgs :: Omicron ( OmicronZoneConfig {
2186
+ OmicronZoneConfig {
2138
2187
zone_type :
2139
2188
OmicronZoneType :: InternalDns {
2140
2189
http_address,
@@ -2144,7 +2193,7 @@ impl ServiceManager {
2144
2193
..
2145
2194
} ,
2146
2195
..
2147
- } ) => {
2196
+ } => {
2148
2197
let underlay_ips = if http_address. ip ( ) == dns_address. ip ( ) {
2149
2198
vec ! [ * http_address. ip( ) ]
2150
2199
} else {
@@ -2225,7 +2274,7 @@ impl ServiceManager {
2225
2274
} ) ?;
2226
2275
RunningZone :: boot ( installed_zone) . await ?
2227
2276
}
2228
- ZoneArgs :: Omicron ( OmicronZoneConfig {
2277
+ OmicronZoneConfig {
2229
2278
zone_type :
2230
2279
OmicronZoneType :: Nexus {
2231
2280
internal_address,
@@ -2235,7 +2284,7 @@ impl ServiceManager {
2235
2284
} ,
2236
2285
id,
2237
2286
..
2238
- } ) => {
2287
+ } => {
2239
2288
let Some ( info) = self . inner . sled_info . get ( ) else {
2240
2289
return Err ( Error :: SledAgentNotReady ) ;
2241
2290
} ;
@@ -2369,7 +2418,29 @@ impl ServiceManager {
2369
2418
} ) ?;
2370
2419
RunningZone :: boot ( installed_zone) . await ?
2371
2420
}
2372
- ZoneArgs :: Switch ( SwitchZoneConfig { id, services, addresses } ) => {
2421
+ } ;
2422
+
2423
+ Ok ( running_zone)
2424
+ }
2425
+
2426
+ async fn boot_switch_zone (
2427
+ & self ,
2428
+ config : & SwitchZoneConfig ,
2429
+ installed_zone : InstalledZone ,
2430
+ links_need_link_local : & [ bool ] ,
2431
+ bootstrap_name_and_address : Option < ( String , Ipv6Addr ) > ,
2432
+ device_names : & [ String ] ,
2433
+ ) -> Result < RunningZone , Error > {
2434
+ // Temporary double-indent to avoid breaking blame.
2435
+ {
2436
+ {
2437
+ let SwitchZoneConfig { id, services, addresses } = config;
2438
+
2439
+ let disabled_dns_client_service = ServiceBuilder :: new (
2440
+ "network/dns/client" ,
2441
+ )
2442
+ . add_instance ( ServiceInstanceBuilder :: new ( "default" ) . disable ( ) ) ;
2443
+
2373
2444
let info = self . inner . sled_info . get ( ) ;
2374
2445
2375
2446
let gw_addr = match info {
@@ -2420,7 +2491,7 @@ impl ServiceManager {
2420
2491
for ( link, needs_link_local) in
2421
2492
installed_zone. links ( ) . iter ( ) . zip ( links_need_link_local)
2422
2493
{
2423
- if needs_link_local {
2494
+ if * needs_link_local {
2424
2495
switch_zone_setup_config = switch_zone_setup_config
2425
2496
. add_property (
2426
2497
"link_local_links" ,
@@ -3081,36 +3152,9 @@ impl ServiceManager {
3081
3152
. map_err ( |err| {
3082
3153
Error :: io ( "Failed to setup Switch zone profile" , err)
3083
3154
} ) ?;
3084
- RunningZone :: boot ( installed_zone) . await ?
3085
- }
3086
- } ;
3087
-
3088
- // Now that we've booted the zone, we'll notify the sled-agent about:
3089
- //
3090
- // - Its control VNIC (all zones have one)
3091
- // - Any bootstrap network VNIC (only the switch zone has one)
3092
- // - Any OPTE ports (instance zones, or Oxide zones with external
3093
- // connectivity).
3094
- //
3095
- // Note that we'll almost always have started the sled-agent at this
3096
- // point. The only exception is the switch zone, during bootstrapping
3097
- // but before we've either run RSS or unlocked the rack. In both those
3098
- // cases, we have a `StartSledAgentRequest`, and so a metrics queue.
3099
- if let Some ( queue) = self . maybe_metrics_queue ( ) {
3100
- match queue. track_zone_links ( & running_zone) {
3101
- Ok ( _) => debug ! ( self . inner. log, "Tracking zone datalinks" ) ,
3102
- Err ( errors) => {
3103
- error ! (
3104
- self . inner. log,
3105
- "Failed to track one or more links in the zone, \
3106
- some metrics will not be produced";
3107
- "zone_name" => running_zone. name( ) ,
3108
- "errors" => ?errors,
3109
- ) ;
3110
- }
3155
+ Ok ( RunningZone :: boot ( installed_zone) . await ?)
3111
3156
}
3112
3157
}
3113
- Ok ( running_zone)
3114
3158
}
3115
3159
3116
3160
// Attempt to start a single Omicron zone.
0 commit comments