@@ -640,11 +640,32 @@ func nodeAddresses(srv *servers.Server, interfaces []attachinterfaces.Interface,
640640 return nil , err
641641 }
642642
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
646644 if len (addresses ) < len (allPrivates ) {
645+ extraPrivates := make (map [string ][]Address )
646+ // For each private network
647647 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 {
648669 v1 , ok := addresses [k ]
649670 if ! ok {
650671 addresses [k ] = v
@@ -777,7 +798,7 @@ func getSubInterfaces(interfaces []attachinterfaces.Interface, network *gophercl
777798 }
778799 }
779800 }
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 )
781802 return subports , nil
782803}
783804
0 commit comments