本文整理汇总了Golang中github.com/contiv/netplugin/core.ResourceManager.DeallocateResourceVal方法的典型用法代码示例。如果您正苦于以下问题:Golang ResourceManager.DeallocateResourceVal方法的具体用法?Golang ResourceManager.DeallocateResourceVal怎么用?Golang ResourceManager.DeallocateResourceVal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/contiv/netplugin/core.ResourceManager
的用法示例。
在下文中一共展示了ResourceManager.DeallocateResourceVal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: FreeVXLAN
// 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})
}
示例2: FreeSubnet
// 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})
}
示例3: FreeVLAN
// 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)
}