|
7 | 7 | use std::net::{IpAddr, Ipv6Addr, SocketAddr, SocketAddrV6};
|
8 | 8 |
|
9 | 9 | use daft::Diffable;
|
| 10 | +use id_map::{IdMap, IdMappable}; |
10 | 11 | use omicron_common::{
|
11 | 12 | api::{
|
12 | 13 | external::{ByteCount, Generation},
|
13 | 14 | internal::shared::{NetworkInterface, SourceNatConfig},
|
14 | 15 | },
|
15 |
| - disk::{ |
16 |
| - DatasetManagementStatus, DatasetsConfig, DiskManagementStatus, |
17 |
| - DiskVariant, OmicronPhysicalDisksConfig, |
18 |
| - }, |
| 16 | + disk::{DatasetConfig, DiskVariant, OmicronPhysicalDiskConfig}, |
19 | 17 | zpool_name::ZpoolName,
|
20 | 18 | };
|
21 | 19 | use omicron_uuid_kinds::{DatasetUuid, OmicronZoneUuid};
|
@@ -128,23 +126,12 @@ pub enum SledRole {
|
128 | 126 | }
|
129 | 127 |
|
130 | 128 | /// Describes the set of Reconfigurator-managed configuration elements of a sled
|
131 |
| -// TODO this struct should have a generation number; at the moment, each of |
132 |
| -// the fields has a separete one internally. |
133 |
| -#[derive( |
134 |
| - Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq, Hash, |
135 |
| -)] |
| 129 | +#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq)] |
136 | 130 | pub struct OmicronSledConfig {
|
137 |
| - pub disks_config: OmicronPhysicalDisksConfig, |
138 |
| - pub datasets_config: DatasetsConfig, |
139 |
| - pub zones_config: OmicronZonesConfig, |
140 |
| -} |
141 |
| - |
142 |
| -/// Result of the currently-synchronous `omicron_config_put` endpoint. |
143 |
| -#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] |
144 |
| -#[must_use = "this `DatasetManagementResult` may contain errors, which should be handled"] |
145 |
| -pub struct OmicronSledConfigResult { |
146 |
| - pub disks: Vec<DiskManagementStatus>, |
147 |
| - pub datasets: Vec<DatasetManagementStatus>, |
| 131 | + pub generation: Generation, |
| 132 | + pub disks: IdMap<OmicronPhysicalDiskConfig>, |
| 133 | + pub datasets: IdMap<DatasetConfig>, |
| 134 | + pub zones: IdMap<OmicronZoneConfig>, |
148 | 135 | }
|
149 | 136 |
|
150 | 137 | /// Describes the set of Omicron-managed zones running on a sled
|
@@ -190,6 +177,14 @@ pub struct OmicronZoneConfig {
|
190 | 177 | pub image_source: OmicronZoneImageSource,
|
191 | 178 | }
|
192 | 179 |
|
| 180 | +impl IdMappable for OmicronZoneConfig { |
| 181 | + type Id = OmicronZoneUuid; |
| 182 | + |
| 183 | + fn id(&self) -> Self::Id { |
| 184 | + self.id |
| 185 | + } |
| 186 | +} |
| 187 | + |
193 | 188 | impl OmicronZoneConfig {
|
194 | 189 | /// Returns the underlay IP address associated with this zone.
|
195 | 190 | ///
|
|
0 commit comments