-
Couldn't load subscription status.
- Fork 293
Filter out link IPv6 when migrating VMs #5463
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
Conversation
f78420f to
3f588db
Compare
3f588db to
6cc2339
Compare
- New pif helper: `get_non_link_ipv6` to get the 1st non link IPv6 of a PIF - Use the helper in `migrate_receive` and `get_primary_address` used in host evacuation to have a valid IPv6 of the destination host Co-authored-by: Pau Ruiz Safont <psafont@users.noreply.github.com> Signed-off-by: Benjamin Reis <benjamin.reis@vates.tech>
944e700 to
c31eb14
Compare
| ) | ||
| | `IPv6 -> | ||
| List.nth_opt (Db.PIF.get_IPv6 ~__context ~self:pif) 0 | ||
| List.nth_opt (get_non_link_ipv6 ~__context ~pif) 0 |
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'm not a fan of this and would prefer to match over this and proper error handling for the [] case (which should never happen but will be difficult to find if it does).
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.
Sure, my understanding is that no IPv6 would result in [""] instead of an empty list so i'm not sure what error could be thrown 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.
You want throw a failtwith __LOC__ if you think this can never happen. But we want to make it easy to find the location if it does happen.
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.
After reviewing the code, i'm not sure throwing here is better. For me, the get_non_link helper is used to have reachable IPv6 from the outside and thus can return an empty list in the case there's none.
Then we mimic the IPv4 case above:
match Db.PIF.get_IP ~__context ~self:pif with "" -> None | ip -> Some ipAnd then it's up to the caller to decide if None is an error case or not like here: https://github.com/xapi-project/xen-api/blob/master/ocaml/xapi/xapi_network_attach_helpers.ml#L109-L114
New pif helper:
get_non_link_ipv6to get the 1st non link IPv6 of a PIFUse the helper in
migrate_receiveandget_primary_addressused in host evacuation to have a valid IPv6 of the destination host