remove host-local-ptp plugin
authorEugene Yakubovich <eugene.yakubovich@coreos.com>
Thu, 17 Sep 2015 21:56:13 +0000 (14:56 -0700)
committerStefan Junker <mail@stefanjunker.de>
Wed, 23 Sep 2015 09:04:38 +0000 (11:04 +0200)
build
plugins/ipam/host-local/allocator.go
plugins/ipam/host-local/main.go

diff --git a/build b/build
index 99f42fb..e2bb47a 100755 (executable)
--- a/build
+++ b/build
@@ -27,7 +27,3 @@ for d in $PLUGINS; do
                go install ${REPO_PATH}/$d
        fi
 done
-
-if [ ! -h $GOBIN/host-local-ptp ]; then
-       ln -s host-local $GOBIN/host-local-ptp
-fi
index 56c7947..9756a11 100644 (file)
@@ -133,50 +133,6 @@ func (a *IPAllocator) Get(id string) (*types.IPConfig, error) {
        return nil, fmt.Errorf("no IP addresses available in network: %s", a.conf.Name)
 }
 
-// Allocates both an IP and the Gateway IP, i.e. a /31
-// This is used for Point-to-Point links
-func (a *IPAllocator) GetPtP(id string) (*types.IPConfig, error) {
-       a.store.Lock()
-       defer a.store.Unlock()
-
-       for cur := a.start; !cur.Equal(a.end); cur = ip.NextIP(cur) {
-               // we're looking for unreserved even, odd pair
-               if !evenIP(cur) {
-                       continue
-               }
-
-               gw := cur
-               reserved, err := a.store.Reserve(id, gw)
-               if err != nil {
-                       return nil, err
-               }
-               if reserved {
-                       cur = ip.NextIP(cur)
-                       if cur.Equal(a.end) {
-                               break
-                       }
-
-                       reserved, err := a.store.Reserve(id, cur)
-                       if err != nil {
-                               return nil, err
-                       }
-                       if reserved {
-                               // found them both!
-                               _, bits := a.conf.Subnet.Mask.Size()
-                               mask := net.CIDRMask(bits-1, bits)
-
-                               return &types.IPConfig{
-                                       IP:      net.IPNet{cur, mask},
-                                       Gateway: gw,
-                                       Routes:  a.conf.Routes,
-                               }, nil
-                       }
-               }
-       }
-
-       return nil, fmt.Errorf("no ip addresses available in network: %s", a.conf.Name)
-}
-
 // Releases all IPs allocated for the container with given ID
 func (a *IPAllocator) Release(id string) error {
        a.store.Lock()
@@ -204,15 +160,3 @@ func networkRange(ipnet *net.IPNet) (net.IP, net.IP, error) {
        }
        return ipnet.IP, end, nil
 }
-
-func evenIP(ip net.IP) bool {
-       i := ip.To4()
-       if i == nil {
-               i = ip.To16()
-               if i == nil {
-                       panic("IP is not v4 or v6")
-               }
-       }
-
-       return i[len(i)-1]%2 == 0
-}
index 18c9756..06c95c9 100644 (file)
@@ -15,8 +15,6 @@
 package main
 
 import (
-       "errors"
-
        "github.com/appc/cni/plugins/ipam/host-local/backend/disk"
 
        "github.com/appc/cni/pkg/skel"
@@ -51,17 +49,7 @@ func cmdAdd(args *skel.CmdArgs) error {
                return err
        }
 
-       var ipConf *types.IPConfig
-
-       switch ipamConf.Type {
-       case "host-local":
-               ipConf, err = allocator.Get(args.ContainerID)
-       case "host-local-ptp":
-               ipConf, err = allocator.GetPtP(args.ContainerID)
-       default:
-               return errors.New("Unsupported IPAM plugin type")
-       }
-
+       ipConf, err := allocator.Get(args.ContainerID)
        if err != nil {
                return err
        }