77 * from within the control plane
88 */
99
10- use std:: convert:: TryFrom ;
11-
1210use omicron_common:: generate_logging_api;
1311
1412generate_logging_api ! ( "../openapi/nexus-internal.json" ) ;
@@ -19,12 +17,6 @@ impl omicron_common::api::external::ClientError for types::Error {
1917 }
2018}
2119
22- impl From < types:: Generation > for omicron_common:: api:: external:: Generation {
23- fn from ( s : types:: Generation ) -> Self {
24- Self :: try_from ( s. 0 as i64 ) . unwrap ( )
25- }
26- }
27-
2820impl From < omicron_common:: api:: external:: ByteCount > for types:: ByteCount {
2921 fn from ( s : omicron_common:: api:: external:: ByteCount ) -> Self {
3022 Self ( s. to_bytes ( ) )
@@ -64,19 +56,6 @@ impl From<types::InstanceState>
6456 }
6557}
6658
67- impl From < omicron_common:: api:: internal:: sled_agent:: DatasetKind >
68- for types:: DatasetKind
69- {
70- fn from ( d : omicron_common:: api:: internal:: sled_agent:: DatasetKind ) -> Self {
71- use omicron_common:: api:: internal:: sled_agent:: DatasetKind :: * ;
72- match d {
73- CockroachDb { .. } => types:: DatasetKind :: Cockroach ,
74- Crucible { .. } => types:: DatasetKind :: Crucible ,
75- Clickhouse { .. } => types:: DatasetKind :: Clickhouse ,
76- }
77- }
78- }
79-
8059impl From < omicron_common:: api:: internal:: nexus:: InstanceRuntimeState >
8160 for types:: InstanceRuntimeState
8261{
@@ -99,63 +78,22 @@ impl From<omicron_common::api::internal::nexus::InstanceRuntimeState>
9978 }
10079}
10180
102- impl From < & omicron_common:: api:: internal:: nexus:: InstanceRuntimeState >
103- for types:: InstanceRuntimeState
104- {
105- fn from (
106- s : & omicron_common:: api:: internal:: nexus:: InstanceRuntimeState ,
107- ) -> Self {
108- Self {
109- run_state : s. run_state . into ( ) ,
110- sled_uuid : s. sled_uuid ,
111- propolis_uuid : s. propolis_uuid ,
112- dst_propolis_uuid : s. dst_propolis_uuid ,
113- propolis_addr : s. propolis_addr . map ( |addr| addr. to_string ( ) ) ,
114- migration_uuid : s. migration_uuid ,
115- ncpus : s. ncpus . into ( ) ,
116- memory : s. memory . into ( ) ,
117- hostname : s. hostname . clone ( ) ,
118- gen : s. gen . into ( ) ,
119- time_updated : s. time_updated ,
120- }
121- }
122- }
123-
12481impl From < omicron_common:: api:: external:: InstanceState >
12582 for types:: InstanceState
12683{
12784 fn from ( s : omicron_common:: api:: external:: InstanceState ) -> Self {
85+ use omicron_common:: api:: external:: InstanceState ;
12886 match s {
129- omicron_common:: api:: external:: InstanceState :: Creating => {
130- Self :: Creating
131- }
132- omicron_common:: api:: external:: InstanceState :: Starting => {
133- Self :: Starting
134- }
135- omicron_common:: api:: external:: InstanceState :: Running => {
136- Self :: Running
137- }
138- omicron_common:: api:: external:: InstanceState :: Stopping => {
139- Self :: Stopping
140- }
141- omicron_common:: api:: external:: InstanceState :: Stopped => {
142- Self :: Stopped
143- }
144- omicron_common:: api:: external:: InstanceState :: Rebooting => {
145- Self :: Rebooting
146- }
147- omicron_common:: api:: external:: InstanceState :: Migrating => {
148- Self :: Migrating
149- }
150- omicron_common:: api:: external:: InstanceState :: Repairing => {
151- Self :: Repairing
152- }
153- omicron_common:: api:: external:: InstanceState :: Failed => {
154- Self :: Failed
155- }
156- omicron_common:: api:: external:: InstanceState :: Destroyed => {
157- Self :: Destroyed
158- }
87+ InstanceState :: Creating => Self :: Creating ,
88+ InstanceState :: Starting => Self :: Starting ,
89+ InstanceState :: Running => Self :: Running ,
90+ InstanceState :: Stopping => Self :: Stopping ,
91+ InstanceState :: Stopped => Self :: Stopped ,
92+ InstanceState :: Rebooting => Self :: Rebooting ,
93+ InstanceState :: Migrating => Self :: Migrating ,
94+ InstanceState :: Repairing => Self :: Repairing ,
95+ InstanceState :: Failed => Self :: Failed ,
96+ InstanceState :: Destroyed => Self :: Destroyed ,
15997 }
16098 }
16199}
@@ -188,26 +126,15 @@ impl From<omicron_common::api::internal::nexus::DiskRuntimeState>
188126
189127impl From < omicron_common:: api:: external:: DiskState > for types:: DiskState {
190128 fn from ( s : omicron_common:: api:: external:: DiskState ) -> Self {
129+ use omicron_common:: api:: external:: DiskState ;
191130 match s {
192- omicron_common:: api:: external:: DiskState :: Creating => {
193- Self :: Creating
194- }
195- omicron_common:: api:: external:: DiskState :: Detached => {
196- Self :: Detached
197- }
198- omicron_common:: api:: external:: DiskState :: Attaching ( u) => {
199- Self :: Attaching ( u)
200- }
201- omicron_common:: api:: external:: DiskState :: Attached ( u) => {
202- Self :: Attached ( u)
203- }
204- omicron_common:: api:: external:: DiskState :: Detaching ( u) => {
205- Self :: Detaching ( u)
206- }
207- omicron_common:: api:: external:: DiskState :: Destroyed => {
208- Self :: Destroyed
209- }
210- omicron_common:: api:: external:: DiskState :: Faulted => Self :: Faulted ,
131+ DiskState :: Creating => Self :: Creating ,
132+ DiskState :: Detached => Self :: Detached ,
133+ DiskState :: Attaching ( u) => Self :: Attaching ( u) ,
134+ DiskState :: Attached ( u) => Self :: Attached ( u) ,
135+ DiskState :: Detaching ( u) => Self :: Detaching ( u) ,
136+ DiskState :: Destroyed => Self :: Destroyed ,
137+ DiskState :: Faulted => Self :: Faulted ,
211138 }
212139 }
213140}
0 commit comments