File tree Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ let with_lock = Xapi_stdext_threads.Threadext.Mutex.execute
2020
2121module Unixext = Xapi_stdext_unix. Unixext
2222open Xapi_host_helpers
23+ open Xapi_pif_helpers
2324open Db_filter_types
2425open Workload_balancing
2526
@@ -2555,14 +2556,10 @@ let migrate_receive ~__context ~host ~network ~options:_ =
25552556 let configuration_mode =
25562557 Db.PIF. get_ipv6_configuration_mode ~__context ~self: pif
25572558 in
2558- match Db.PIF. get_IPv6 ~__context ~self: pif with
2559+ match Xapi_pif_helpers. get_non_link_ipv6 ~__context ~pif with
25592560 | [] ->
25602561 (" " , configuration_mode)
2561- | ip :: _ ->
2562- (* The CIDR is also stored in the IPv6 field of a PIF. *)
2563- let ipv6 =
2564- match String. split_on_char '/' ip with hd :: _ -> hd | _ -> " "
2565- in
2562+ | ipv6 :: _ ->
25662563 (ipv6, configuration_mode)
25672564 )
25682565 in
Original file line number Diff line number Diff line change @@ -255,10 +255,29 @@ let is_device_underneath_same_type ~__context pif1 pif2 =
255255 in
256256 get_device_info pif1 = get_device_info pif2
257257
258+ let get_non_link_ipv6 ~__context ~pif =
259+ let non_link_ip6s =
260+ List. map
261+ (fun ip6 ->
262+ match Ipaddr.V6.Prefix. of_string ip6 with
263+ | Error _ ->
264+ None
265+ | Ok ip6 ->
266+ let ip6 = Ipaddr.V6.Prefix. address ip6 in
267+ if Ipaddr.V6. scope ip6 = Ipaddr. Link then
268+ None
269+ else
270+ Some (Ipaddr.V6. to_string ip6)
271+ )
272+ (Db.PIF. get_IPv6 ~__context ~self: pif)
273+ in
274+ List. map (Option. fold ~none: " " ~some: Fun. id) non_link_ip6s
275+ |> List. filter (( <> ) " " )
276+
258277let get_primary_address ~__context ~pif =
259278 match Db.PIF. get_primary_address_type ~__context ~self: pif with
260279 | `IPv4 -> (
261280 match Db.PIF. get_IP ~__context ~self: pif with "" -> None | ip -> Some ip
262281 )
263282 | `IPv6 ->
264- List. nth_opt (Db.PIF. get_IPv6 ~__context ~self: pif) 0
283+ List. nth_opt (get_non_link_ipv6 ~__context ~pif ) 0
You can’t perform that action at this time.
0 commit comments