Skip to content

Commit 41d4372

Browse files
committed
Revert "Fixup: avoid read inventory when device already renamed"
This reverts commit 402671f. Signed-off-by: Changlei Li <[email protected]>
1 parent 53752d2 commit 41d4372

File tree

1 file changed

+21
-28
lines changed

1 file changed

+21
-28
lines changed

ocaml/networkd/lib/network_config.ml

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -132,35 +132,28 @@ let read_management_conf interface_order =
132132
order
133133
in
134134
let bridge_name =
135-
let get_bridge_name () =
136-
if vlan = None then
137-
bridge_naming_convention device pos_opt
138-
else
139-
(* At this point, we don't know what the VLAN bridge name will be,
140-
* so use a temporary name. Xapi will replace the bridge once the name
141-
* has been decided on. *)
142-
temp_vlan
135+
let inventory_bridge =
136+
try Some (Inventory.lookup Inventory._management_interface)
137+
with Inventory.Missing_inventory_key _ -> None
143138
in
144-
if Network_utils.device_already_renamed then (
145-
let inventory_bridge =
146-
try Some (Inventory.lookup Inventory._management_interface)
147-
with Inventory.Missing_inventory_key _ -> None
148-
in
149-
match inventory_bridge with
150-
| Some "" | None ->
151-
let bridge = get_bridge_name () in
152-
debug "No management bridge in inventory file... using %s" bridge ;
153-
bridge
154-
| Some bridge ->
155-
debug "Management bridge in inventory file: %s" bridge ;
156-
bridge
157-
) else
158-
(* As design: If interfaces are sorted by networkd, the management
159-
interface need be written to inventory by networkd, too *)
160-
let bridge = get_bridge_name () in
161-
debug "management bridge name %s" bridge ;
162-
write_manage_iface_to_inventory bridge ;
163-
bridge
139+
match inventory_bridge with
140+
| Some "" | None ->
141+
let bridge =
142+
if vlan = None then
143+
bridge_naming_convention device pos_opt
144+
else
145+
(* At this point, we don't know what the VLAN bridge name will be,
146+
* so use a temporary name. Xapi will replace the bridge once the name
147+
* has been decided on. *)
148+
temp_vlan
149+
in
150+
debug "No management bridge in inventory file... using %s" bridge ;
151+
if not Network_utils.device_already_renamed then
152+
write_manage_iface_to_inventory bridge ;
153+
bridge
154+
| Some bridge ->
155+
debug "Management bridge in inventory file: %s" bridge ;
156+
bridge
164157
in
165158
let mac = Network_utils.Ip.get_mac device in
166159
let dns = parse_dns_config args in

0 commit comments

Comments
 (0)