@@ -640,11 +640,32 @@ func nodeAddresses(srv *servers.Server, interfaces []attachinterfaces.Interface,
640
640
return nil , err
641
641
}
642
642
643
- // Add subports as if they are directly attached
644
- klog .V (5 ).Infof ("Node '%s' is directly attached to %d networks '%s'" , srv .Name , len (addresses ), addresses )
645
- klog .V (5 ).Infof ("Node '%s' is attached to %d networks '%s'" , srv .Name , len (allPrivates ), allPrivates )
643
+ // Get the private networks that are not directly connected
646
644
if len (addresses ) < len (allPrivates ) {
645
+ extraPrivates := make (map [string ][]Address )
646
+ // For each private network
647
647
for k , v := range allPrivates {
648
+ ok := false
649
+ // For each address in the private network
650
+ for _ , a := range v {
651
+ // Check if the address is directly connected
652
+ for _ , v1 := range addresses {
653
+ for _ , a1 := range v1 {
654
+ if a .Addr == a1 .Addr {
655
+ ok = true
656
+ break
657
+ }
658
+ }
659
+ }
660
+ }
661
+ // All the addresses in the private network are not directly connected
662
+ // Save the private network
663
+ if ! ok {
664
+ extraPrivates [k ] = v
665
+ }
666
+ }
667
+ klog .V (5 ).Infof ("Node '%s' extraPrivates '%s'" , srv .Name , extraPrivates )
668
+ for k , v := range extraPrivates {
648
669
v1 , ok := addresses [k ]
649
670
if ! ok {
650
671
addresses [k ] = v
@@ -777,7 +798,7 @@ func getSubInterfaces(interfaces []attachinterfaces.Interface, network *gophercl
777
798
}
778
799
}
779
800
}
780
- klog .V (5 ).Infof ("Node has %d subports '%v'" , len (subports ), subports )
801
+ klog .V (5 ).Infof ("Node has %d sub-interfaces '%v'" , len (subports ), subports )
781
802
return subports , nil
782
803
}
783
804
0 commit comments