Forráskód Böngészése

Merge pull request #625 from aboch/acf

Relax restriction on IpamConfig
Madhu Venugopal 9 éve
szülő
commit
f8891e4f4a
2 módosított fájl, 3 hozzáadás és 5 törlés
  1. 1 1
      libnetwork/libnetwork_internal_test.go
  2. 2 4
      libnetwork/network.go

+ 1 - 1
libnetwork/libnetwork_internal_test.go

@@ -238,7 +238,7 @@ func compareIpamConfList(listA, listB []*IpamConf) bool {
 		a = listA[i]
 		a = listA[i]
 		b = listB[i]
 		b = listB[i]
 		if a.PreferredPool != b.PreferredPool ||
 		if a.PreferredPool != b.PreferredPool ||
-			a.SubPool != b.SubPool || a.IsV6 != b.IsV6 ||
+			a.SubPool != b.SubPool ||
 			!compareStringMaps(a.Options, b.Options) ||
 			!compareStringMaps(a.Options, b.Options) ||
 			a.Gateway != b.Gateway || !compareStringMaps(a.AuxAddresses, b.AuxAddresses) {
 			a.Gateway != b.Gateway || !compareStringMaps(a.AuxAddresses, b.AuxAddresses) {
 			return false
 			return false

+ 2 - 4
libnetwork/network.go

@@ -76,8 +76,6 @@ type IpamConf struct {
 	SubPool string
 	SubPool string
 	// Input options for IPAM Driver (optional)
 	// Input options for IPAM Driver (optional)
 	Options map[string]string
 	Options map[string]string
-	// IPv6 flag, Needed when no preferred pool is specified
-	IsV6 bool
 	// Preferred Network Gateway address (optional)
 	// Preferred Network Gateway address (optional)
 	Gateway string
 	Gateway string
 	// Auxiliary addresses for network driver. Must be within the master pool.
 	// Auxiliary addresses for network driver. Must be within the master pool.
@@ -889,7 +887,7 @@ func (n *network) ipamAllocateVersion(ipVer int, ipam ipamapi.Ipam) error {
 		return types.InternalErrorf("incorrect ip version passed to ipam allocate: %d", ipVer)
 		return types.InternalErrorf("incorrect ip version passed to ipam allocate: %d", ipVer)
 	}
 	}
 
 
-	if *cfgList == nil {
+	if len(*cfgList) == 0 {
 		if ipVer == 6 {
 		if ipVer == 6 {
 			return nil
 			return nil
 		}
 		}
@@ -907,7 +905,7 @@ func (n *network) ipamAllocateVersion(ipVer int, ipam ipamapi.Ipam) error {
 		d := &IpamInfo{}
 		d := &IpamInfo{}
 		(*infoList)[i] = d
 		(*infoList)[i] = d
 
 
-		d.PoolID, d.Pool, d.Meta, err = ipam.RequestPool(n.addrSpace, cfg.PreferredPool, cfg.SubPool, cfg.Options, cfg.IsV6)
+		d.PoolID, d.Pool, d.Meta, err = ipam.RequestPool(n.addrSpace, cfg.PreferredPool, cfg.SubPool, cfg.Options, ipVer == 6)
 		if err != nil {
 		if err != nil {
 			return err
 			return err
 		}
 		}