remove host-local-ptp plugin

This commit is contained in:
Eugene Yakubovich
2015-09-17 14:56:13 -07:00
committed by Stefan Junker
parent 7d8d6b2a7e
commit 60be55a7d1
3 changed files with 1 additions and 73 deletions

View 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
}