File tree Expand file tree Collapse file tree 3 files changed +20
-13
lines changed Expand file tree Collapse file tree 3 files changed +20
-13
lines changed Original file line number Diff line number Diff line change @@ -136,8 +136,21 @@ let sync_state () =
136
136
write_config ()
137
137
138
138
let reset_state () =
139
- let interface_order, _ = sort Network_config. initial_interface_order in
140
- config := Network_config. read_management_conf interface_order
139
+ let reset_order =
140
+ match ! config.interface_order with
141
+ | Some _ ->
142
+ (* Use empty config interface_order to sort to generate fresh-install
143
+ state for currently-installed hardware *)
144
+ sort Network_config. empty_config.interface_order |> fst
145
+ | None ->
146
+ ignore
147
+ (Forkhelpers. execute_command_get_output
148
+ " /etc/sysconfig/network-scripts/interface-rename.py"
149
+ [" --reset-to-install" ]
150
+ ) ;
151
+ None
152
+ in
153
+ config := Network_config. read_management_conf reset_order
141
154
142
155
let set_gateway_interface _dbg name =
143
156
(* Remove dhclient conf (if any) for the old and new gateway interfaces.
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ let refresh_internal ~__context ~interface_tables ~self =
116
116
info " PIF: device name changed from %s to %s" original_name name ;
117
117
name
118
118
| None -> (
119
- (* This clause should be unlike to happen, if enter this, check the if
119
+ (* This clause should be unlikely to happen, if enter this, check the if
120
120
we can get mac from networkd. If yes there may be a bug *)
121
121
warn " PIF %s: no device found for position %d" original_name position ;
122
122
try
Original file line number Diff line number Diff line change @@ -2088,7 +2088,6 @@ let eject_self ~__context ~host =
2088
2088
configuration_file
2089
2089
in
2090
2090
write_first_boot_management_interface_configuration_file () ;
2091
- Net. reset_state () ;
2092
2091
Xapi_inventory. update Xapi_inventory. _current_interfaces " " ;
2093
2092
(* Destroy my control domains, since you can't do this from the API [operation not allowed] *)
2094
2093
( try
@@ -2148,15 +2147,10 @@ let eject_self ~__context ~host =
2148
2147
(! Xapi_globs. remote_db_conf_fragment_path ^ " .bak" )
2149
2148
)
2150
2149
() ;
2151
- (* Reset the domain 0 network interface naming configuration
2152
- * back to a fresh-install state for the currently-installed
2153
- * hardware.
2154
- *)
2155
- ignore
2156
- (Forkhelpers. execute_command_get_output
2157
- " /etc/sysconfig/network-scripts/interface-rename.py"
2158
- [" --reset-to-install" ]
2159
- )
2150
+ (* Reset the domain 0 network interface order back to a fresh-install
2151
+ * state for the currently-installed hardware and reset networkd config.
2152
+ *)
2153
+ Net. reset_state ()
2160
2154
)
2161
2155
(fun () -> Xapi_fuse. light_fuse_and_reboot_after_eject () ) ;
2162
2156
Xapi_hooks. pool_eject_hook ~__context
You can’t perform that action at this time.
0 commit comments