-
Notifications
You must be signed in to change notification settings - Fork 292
CP-308260: Handle networkd upgrade #6511
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
CP-308260: Handle networkd upgrade #6511
Conversation
ca7aeb8
to
f6df121
Compare
ocaml/networkd/bin/network_server.ml
Outdated
|
||
let read_previous_inventory () = | ||
let previous_inventory = "/var/tmp/.previousInventory" in | ||
Xapi_stdext_unix.Unixext.file_lines_fold |
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 can fail and I think the error needs to be treated here.
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 am intended to expose the error.
We can only write a default management interface like "xenbr0" to inventory if it fails. But I think it's not reasonable in upgrade scenario. So, I want to expose the error.
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 am also slightly concerned about using a hidden file in /var/tmp
. I would assume that his file should reside in /var/run/networkd/
to avoid any collisions with other services and to signal that this belongs to networkd. What is the lifetime of this file?
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.
See https://github.com/xenserver/host-installer/blob/v11.0.23/upgrade.py#L426. This file is a backup of old inventory during upgrade. It is also used in https://github.com/xapi-project/xen-api/blob/v25.21.0/ocaml/xapi/xapi_db_upgrade.ml#L254.
The tmp file is cleared on reboot.
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 handle the exception explicitly in the latest commit by logging and raising a new Network_error-Internal_error
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 finally give up raising a new Network_error-Internal_error, just log an error message, to keep the uniform style.
2ccd90e
to
9a95184
Compare
9a95184
to
380dea5
Compare
I need to sync feature branch with master to adopt #6512 to fix CI error. |
Consider both device_already_renamed and last_order: True, None -> The netdev-rename version behaviour True, Some _ -> Impossible False, None -> Upgrade from netdev-rename version False, None -> The networkd-sort version behaviour To handle the upgrade, the previous order is converted and passed to initial rules. So use [] here to sort. Signed-off-by: Changlei Li <[email protected]>
Netwrok_device_order.sort won't return changed_interfaces as last_order is void. Need to generate it based on the eth devs name and sorted interface order for upgrade. Signed-off-by: Changlei Li <[email protected]>
Read management interface and addr type from previous inventory, write to inventory file. Signed-off-by: Changlei Li <[email protected]>
26e294f
to
00d859c
Compare
00d859c
to
c020dc7
Compare
- Add function name in error log - Use sscanf to get index of ethx - Handle the exception explicitly when reading previous inventory - Add more error log - Don't write to inventory if not read the concerned keys Signed-off-by: Changlei Li <[email protected]>
c020dc7
to
bc6c7d1
Compare
Test upgrade manually success. |
0a75417
into
xapi-project:feature/host-network-device-ordering
In the upgrade scenario, net devices order has been converted to initial rule and pass to new system. See xenserver/host-installer#249
This PR is to handle the remaining things in networkd:
/var/tmp/.previousInventory
and write to inventory