-
Notifications
You must be signed in to change notification settings - Fork 291
CP-54444: Return MAC addresses to host installer #6466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/host-network-device-ordering
Are you sure you want to change the base?
CP-54444: Return MAC addresses to host installer #6466
Conversation
The host installer uses this utility to get the management interface from the management bridge. Now it changes to use MAC address(es) to find out the management interface(s). This is because the interface-rename functionality will be deprecated and the names of the network interfaces are not guaranteed to be the same between dom0 and host installer's running environment. Note that this change must be delivered to a host before upgrading to a new version in which the interface-rename is deprecated because the host installer is built from the new version and it will not be able to find the management network interface by name if the networkd_db command returns only names generated by interface-rename. Specifically, the "interface_order" field is only available when the networkd takes place of interface-rename to generate order. Before that, only the "bridge_mac" can be used because at that time, the host installer only uses one interface to setup its own networking during installation and no MAC addresses are recorded in networkd.db for individual interfaces. The "bridge_mac" is just the MAC address of one of the interfaces which construct the management bridge. Signed-off-by: Ming Lu <[email protected]>
xenserver/host-installer#249 is for the host installer change. |
ocaml/networkd/bin_db/networkd_db.ml
Outdated
if List.mem_assoc !bridge config.bridge_config then | ||
let bridge_config = List.assoc !bridge config.bridge_config in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if List.mem_assoc !bridge config.bridge_config then | |
let bridge_config = List.assoc !bridge config.bridge_config in | |
match List.assoc_opt !bridge config.bridge_config with | |
| Some bridge_config -> |
ocaml/networkd/bin_db/networkd_db.ml
Outdated
Error (Printf.sprintf "Could not find MAC address of %s\n" name) | ||
in | ||
let macs = | ||
match config.interface_order with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather have not use the if for ifaces and incorporate it to the match
match config.interface_order with | |
match (config.interface_order, ifaces) with |
ocaml/networkd/bin_db/networkd_db.ml
Outdated
Printf.fprintf stderr "%s\n" msg | ||
| Ok macs -> ( | ||
Printf.printf "interfaces=%s\n" (String.concat "," ifaces) ; | ||
Printf.printf "hwaddrs=%s\n" (String.concat "," (List.rev macs)) ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does adding this line work with the current script?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The current script doesn't care about any extra keys in the output.
Signed-off-by: Ming Lu <[email protected]>
Signed-off-by: Ming Lu <[email protected]>
in | ||
Printf.printf "interfaces=%s\n" (String.concat "," ifaces) ; | ||
match bridge_config.vlan with | ||
( if !bridge <> "" then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the case of !bridge = ""
not be handled as part of List.assoc_opt
returning Null
? I would try to reduce the deep nesting of conditions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to distinguish the cases that no -bridge
option and -bridge <br> where <br> is an invalid one
.
The host installer uses this utility to get the management interface from the management bridge. Now it changes to use MAC address(es) to find out the management interface(s). This is because the interface-rename functionality will be deprecated and the names of the network interfaces are not guaranteed to be the same between dom0 and host installer's running environment.
Note that this change must be delivered to a host before upgrading to a new version in which the interface-rename is deprecated because the host installer is built from the new version and it will not be able to find the management network interface by name if the networkd_db command returns only names generated by interface-rename.
Specifically, the "interface_order" field is only available when the networkd takes place of interface-rename to generate order. Before that, only the "bridge_mac" can be used because at that time, the host installer only uses one interface to setup its own networking during installation and no MAC addresses are recorded in networkd.db for individual interfaces. The "bridge_mac" is just the MAC address of one of the interfaces which construct the management bridge.