Esempio n. 1
0
// FreeVXLAN returns a VXLAN id to the pool.
func (gc *Cfg) FreeVXLAN(ra core.ResourceManager, vxlan uint, localVLAN uint) error {
	g := &Oper{}
	g.StateDriver = gc.StateDriver
	err := g.Read(gc.Tenant)
	if err != nil {
		return nil
	}

	return ra.DeallocateResourceVal(gc.Tenant, resources.AutoVXLANResource,
		resources.VXLANVLANPair{
			VXLAN: vxlan - g.FreeVXLANsStart,
			VLAN:  localVLAN})
}
Esempio n. 2
0
// FreeSubnet releases a subnet derived from it's CIDR.
func (gc *Cfg) FreeSubnet(ra core.ResourceManager, subnetIP string) error {
	return ra.DeallocateResourceVal(gc.Tenant, resources.AutoSubnetResource,
		resources.SubnetIPLenPair{
			IP:  net.ParseIP(subnetIP),
			Len: gc.Auto.AllocSubnetLen})
}
Esempio n. 3
0
// FreeVLAN releases a VLAN for a given ID.
func (gc *Cfg) FreeVLAN(ra core.ResourceManager, vlan uint) error {
	return ra.DeallocateResourceVal(gc.Tenant, resources.AutoVLANResource, vlan)
}