@@ -31,11 +31,16 @@ use std::str::FromStr;
3131use strum:: EnumString ;
3232use url:: Url ;
3333
34- pub const CONFIG_VERSION : & str = "1.10 .0" ;
34+ pub const CONFIG_VERSION : & str = "1.11 .0" ;
3535
3636/// List of field paths that have been removed and should not be reused.
37- pub static RESERVED_FIELD_PATHS : & [ & str ] =
38- & [ "icos_settings.logging" , "icos_settings.use_nns_public_key" ] ;
37+ pub static RESERVED_FIELD_PATHS : & [ & str ] = & [
38+ "icos_settings.logging" ,
39+ "icos_settings.use_nns_public_key" ,
40+ "hostos_settings.vm_cpu" ,
41+ "hostos_settings.vm_memory" ,
42+ "hostos_settings.vm_nr_of_vcpus" ,
43+ ] ;
3944
4045pub type ConfigMap = HashMap < String , String > ;
4146
@@ -148,37 +153,13 @@ pub struct ICOSDevSettings {}
148153pub struct SetupOSSettings ;
149154
150155/// HostOS-specific settings.
151- #[ derive( Serialize , Deserialize , Debug , PartialEq , Eq , Clone ) ]
156+ #[ derive( Serialize , Deserialize , Debug , PartialEq , Eq , Clone , Default ) ]
152157pub struct HostOSSettings {
153158 #[ serde( default ) ]
154159 pub hostos_dev_settings : HostOSDevSettings ,
155- #[ deprecated( note = "Please use hostos_dev_settings" ) ]
156- pub vm_memory : u32 ,
157- #[ deprecated( note = "Please use hostos_dev_settings" ) ]
158- pub vm_cpu : String ,
159- #[ deprecated( note = "Please use hostos_dev_settings" ) ]
160- #[ serde( default = "default_vm_nr_of_vcpus" ) ]
161- pub vm_nr_of_vcpus : u32 ,
162160 pub verbose : bool ,
163161}
164162
165- impl Default for HostOSSettings {
166- fn default ( ) -> Self {
167- #[ allow( deprecated) ]
168- HostOSSettings {
169- vm_memory : Default :: default ( ) ,
170- vm_cpu : Default :: default ( ) ,
171- vm_nr_of_vcpus : default_vm_nr_of_vcpus ( ) ,
172- verbose : Default :: default ( ) ,
173- hostos_dev_settings : Default :: default ( ) ,
174- }
175- }
176- }
177-
178- const fn default_vm_nr_of_vcpus ( ) -> u32 {
179- 64
180- }
181-
182163/// HostOS development configuration. These settings are strictly used for development images.
183164#[ derive( Serialize , Deserialize , Debug , PartialEq , Eq , Clone ) ]
184165pub struct HostOSDevSettings {
@@ -337,33 +318,6 @@ mod tests {
337318 use serde_json:: Value ;
338319 use std:: collections:: HashSet ;
339320
340- #[ test]
341- fn test_vm_nr_of_vcpus_deserialization ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
342- #[ allow( deprecated) ]
343- {
344- // Test with vm_nr_of_vcpus specified
345- let json = r#"{
346- "vm_memory": 16,
347- "vm_cpu": "host",
348- "vm_nr_of_vcpus": 4,
349- "verbose": true
350- }"# ;
351- let settings: HostOSSettings = serde_json:: from_str ( json) ?;
352- assert_eq ! ( settings. vm_nr_of_vcpus, 4 ) ;
353-
354- // Test without vm_nr_of_vcpus (should use default)
355- let json = r#"{
356- "vm_memory": 16,
357- "vm_cpu": "host",
358- "verbose": true
359- }"# ;
360- let settings: HostOSSettings = serde_json:: from_str ( json) ?;
361- assert_eq ! ( settings. vm_nr_of_vcpus, 64 ) ;
362- }
363-
364- Ok ( ( ) )
365- }
366-
367321 #[ test]
368322 fn test_guest_vm_type_forward_compatibility ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
369323 // Test that unknown enum variants deserialize to Unknown
0 commit comments