|
7 | 7 | use std::net::{IpAddr, Ipv6Addr, SocketAddr, SocketAddrV6}; |
8 | 8 |
|
9 | 9 | use daft::Diffable; |
| 10 | +use id_map::IdMap; |
| 11 | +use id_map::IdMappable; |
10 | 12 | use omicron_common::{ |
11 | 13 | api::{ |
12 | 14 | external::{ByteCount, Generation}, |
13 | 15 | internal::shared::{NetworkInterface, SourceNatConfig}, |
14 | 16 | }, |
15 | 17 | disk::{ |
16 | | - DatasetManagementStatus, DatasetsConfig, DiskManagementStatus, |
17 | | - DiskVariant, OmicronPhysicalDisksConfig, |
| 18 | + DatasetConfig, DatasetManagementStatus, DiskManagementStatus, |
| 19 | + DiskVariant, OmicronPhysicalDiskConfig, |
18 | 20 | }, |
19 | 21 | zpool_name::ZpoolName, |
20 | 22 | }; |
@@ -130,13 +132,12 @@ pub enum SledRole { |
130 | 132 | /// Describes the set of Reconfigurator-managed configuration elements of a sled |
131 | 133 | // TODO this struct should have a generation number; at the moment, each of |
132 | 134 | // the fields has a separete one internally. |
133 | | -#[derive( |
134 | | - Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq, Hash, |
135 | | -)] |
| 135 | +#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq)] |
136 | 136 | pub struct OmicronSledConfig { |
137 | | - pub disks_config: OmicronPhysicalDisksConfig, |
138 | | - pub datasets_config: DatasetsConfig, |
139 | | - pub zones_config: OmicronZonesConfig, |
| 137 | + pub generation: Generation, |
| 138 | + pub disks: IdMap<OmicronPhysicalDiskConfig>, |
| 139 | + pub datasets: IdMap<DatasetConfig>, |
| 140 | + pub zones: IdMap<OmicronZoneConfig>, |
140 | 141 | } |
141 | 142 |
|
142 | 143 | /// Result of the currently-synchronous `omicron_config_put` endpoint. |
@@ -190,6 +191,14 @@ pub struct OmicronZoneConfig { |
190 | 191 | pub image_source: OmicronZoneImageSource, |
191 | 192 | } |
192 | 193 |
|
| 194 | +impl IdMappable for OmicronZoneConfig { |
| 195 | + type Id = OmicronZoneUuid; |
| 196 | + |
| 197 | + fn id(&self) -> Self::Id { |
| 198 | + self.id |
| 199 | + } |
| 200 | +} |
| 201 | + |
193 | 202 | impl OmicronZoneConfig { |
194 | 203 | /// Returns the underlay IP address associated with this zone. |
195 | 204 | /// |
|
0 commit comments