@@ -128,27 +128,12 @@ struct FortanixVmeConfig {
128128 enclave_name : Option < String > ,
129129
130130 /// Specifies the number of vCPUs to allocate to the enclave.
131- /// Shouldn't coexist with `cpu_ids`.
132- cpu_count : Option < isize > ,
133-
134- /// Specifies the IDs of the vCPUs to allocate to the enclave.
135- /// Shouldn't coexist with `cpu_count`.
136- cpu_ids : Option < String > ,
131+ cpu_count : isize ,
137132
138133 /// Specifies the amount of memory (in MiB) to allocate to the enclave.
139134 /// Should be at least 64 MiB.
140135 memory : isize ,
141136
142- /// Basically this field represents the vsock address of
143- /// the enclave.
144- /// This field should always be greater than equal to 4.
145- ///
146- /// The CID of parent instance is always 3 as per:
147- /// https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave-concepts.html#term-socket
148- ///
149- /// Vsock CID is analogous to an IP address.
150- enclave_cid : Option < String > ,
151-
152137 /// `false` by default. This enables debug mode of `nitro-cli run-enclave`.
153138 debug_mode : bool ,
154139}
@@ -176,40 +161,20 @@ impl FortanixVmeConfig {
176161 package. metadata
177162 . map ( |metadata| metadata. fortanix_vme )
178163 } )
179- . flatten ( ) ;
180-
181- let config = if let Some ( fortanix_vme_metadata) = fortanix_vme_metadata {
182-
183- // Use default cpu count if metadata doesn't specify cpu_ids or cpu_count.
184- // Also, specifying both cpu_count and cpu_ids is invalid but we don't handle it here
185- // because nitro-cli will anyway error out if that's the case.
186- let ( cpu_ids, cpu_count) = match ( fortanix_vme_metadata. cpu_ids , fortanix_vme_metadata. cpu_count ) {
187- ( None , None ) => ( None , Some ( FortanixVmeConfig :: DEFAULT_CPU_COUNT ) ) ,
188- val => val,
189- } ;
190-
191- FortanixVmeConfig {
192- cpu_count,
193- cpu_ids,
194- .. fortanix_vme_metadata
195- }
196- } else {
197- Default :: default ( )
198- } ;
199-
200- Ok ( config)
164+ . flatten ( )
165+ . unwrap_or_default ( ) ;
166+
167+ Ok ( fortanix_vme_metadata)
201168 }
202169}
203170
204171impl Default for FortanixVmeConfig {
205172 fn default ( ) -> Self {
206173 Self {
207- cpu_count : Some ( FortanixVmeConfig :: DEFAULT_CPU_COUNT ) ,
174+ cpu_count : FortanixVmeConfig :: DEFAULT_CPU_COUNT ,
208175 memory : FortanixVmeConfig :: DEFAULT_MEMORY ,
209176 debug_mode : false ,
210177 enclave_name : None ,
211- cpu_ids : None ,
212- enclave_cid : None ,
213178 verbose : false ,
214179 eif_file_path : FortanixVmeConfig :: default_eif_path ( ) ,
215180 resource_path : None ,
@@ -248,11 +213,9 @@ fn main() -> anyhow::Result<()> {
248213 "nitro-cli" => args(
249214 "run-enclave" ,
250215 "--enclave-name" => ?is_some( fortanix_vme_config. enclave_name) ,
251- "--cpu-count" => ?is_some( fortanix_vme_config. cpu_count. map( |c| c. to_string( ) ) ) ,
252- "--cpu-ids" => ?is_some( fortanix_vme_config. cpu_ids) ,
216+ "--cpu-count" => fortanix_vme_config. cpu_count. to_string( ) ,
253217 "--eif-path" => & fortanix_vme_config. eif_file_path,
254218 "--memory" => fortanix_vme_config. memory. to_string( ) ,
255- "--enclave-cid" => ?is_some( fortanix_vme_config. enclave_cid) ,
256219 "--debug-mode" => ?is_true( fortanix_vme_config. debug_mode)
257220 )
258221 } ;
0 commit comments