File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Expand file tree Collapse file tree 2 files changed +16
-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            (" " 
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,22 @@ 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  valid_nonlink  ipv6  = 
260+     let  open  Ipaddr.V6  in 
261+     ipv6
262+     |>  Prefix. of_string
263+     |>  Result. to_option
264+     |>  Fun. flip Option. bind @@  fun  cidr  ->
265+        let  addr =  Prefix. address cidr in 
266+        match  scope addr with  Ipaddr. Link  ->  None  |  _  ->  Some  (to_string addr)
267+   in 
268+   List. filter_map valid_nonlink (Db.PIF. get_IPv6 ~__context ~self: pif)
269+ 
258270let  get_primary_address  ~__context  ~pif   = 
259271  match  Db.PIF. get_primary_address_type ~__context ~self: pif with 
260272  |  `IPv4  -> (
261273    match  Db.PIF. get_IP ~__context ~self: pif with  ""  ->  None  |  ip  ->  Some  ip
262274  )
263275  |  `IPv6  ->
264-       List. nth_opt (Db.PIF. get_IPv6  ~__context ~self:  pif) 0 
276+       List. nth_opt (get_non_link_ipv6  ~__context ~pif ) 0 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments