本文整理匯總了Golang中github.com/contiv/netplugin/gstate.Cfg.FreeVLAN方法的典型用法代碼示例。如果您正苦於以下問題:Golang Cfg.FreeVLAN方法的具體用法?Golang Cfg.FreeVLAN怎麽用?Golang Cfg.FreeVLAN使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/contiv/netplugin/gstate.Cfg
的用法示例。
在下文中一共展示了Cfg.FreeVLAN方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: freeNetworkResources
func freeNetworkResources(stateDriver core.StateDriver, nwCfg *mastercfg.CfgNetworkState, gCfg *gstate.Cfg) (err error) {
tempRm, err := resources.GetStateResourceManager()
if err != nil {
return err
}
rm := core.ResourceManager(tempRm)
if nwCfg.PktTagType == "vlan" {
err = gCfg.FreeVLAN(rm, uint(nwCfg.PktTag))
if err != nil {
return err
}
} else if nwCfg.PktTagType == "vxlan" {
log.Infof("freeing vlan %d vxlan %d", nwCfg.PktTag, nwCfg.ExtPktTag)
err = gCfg.FreeVXLAN(rm, uint(nwCfg.ExtPktTag), uint(nwCfg.PktTag))
if err != nil {
return err
}
}
if nwCfg.SubnetIsAllocated {
log.Infof("freeing subnet %s/%d", nwCfg.SubnetIP, nwCfg.SubnetLen)
err = gCfg.FreeSubnet(rm, nwCfg.SubnetIP)
if err != nil {
return err
}
}
if err := gCfg.UnassignNetwork(nwCfg.ID); err != nil {
return err
}
return err
}
示例2: freeNetworkResources
func freeNetworkResources(stateDriver core.StateDriver, nwMasterCfg *NwConfig,
nwCfg *drivers.OvsCfgNetworkState, gCfg *gstate.Cfg) (err error) {
tempRm, err := resources.GetStateResourceManager()
if err != nil {
return err
}
rm := core.ResourceManager(tempRm)
if nwCfg.PktTagType == "vlan" {
err = gCfg.FreeVLAN(rm, uint(nwCfg.PktTag))
if err != nil {
return err
}
} else if nwCfg.PktTagType == "vxlan" {
log.Infof("freeing vlan %d vxlan %d", nwCfg.PktTag, nwCfg.ExtPktTag)
err = gCfg.FreeVXLAN(rm, uint(nwCfg.ExtPktTag), uint(nwCfg.PktTag))
if err != nil {
return err
}
}
if nwMasterCfg.SubnetIP == "" {
log.Infof("freeing subnet %s/%s", nwCfg.SubnetIP, nwCfg.SubnetLen)
err = gCfg.FreeSubnet(rm, nwCfg.SubnetIP)
if err != nil {
return err
}
}
return err
}
示例3: DeleteEndpointGroup
// DeleteEndpointGroup handles endpoint group deletes
func DeleteEndpointGroup(epgID int) error {
// Get the state driver
stateDriver, err := utils.GetStateDriver()
if err != nil {
return err
}
epgCfg := &mastercfg.EndpointGroupState{}
epgCfg.StateDriver = stateDriver
err = epgCfg.Read(strconv.Itoa(epgID))
if err != nil {
log.Errorf("EpGroup %v is not configured", epgID)
return err
}
gCfg := gstate.Cfg{}
gCfg.StateDriver = stateDriver
err = gCfg.Read(epgCfg.Tenant)
if err != nil {
log.Errorf("error reading tenant cfg state. Error: %s", err)
return err
}
// if aci mode we allocate per-epg vlan. free it here.
aciMode, aErr := IsAciConfigured()
if aErr != nil {
return aErr
}
if aciMode {
tempRm, rErr := resources.GetStateResourceManager()
if rErr != nil {
return rErr
}
rm := core.ResourceManager(tempRm)
if epgCfg.PktTagType == "vlan" {
err = gCfg.FreeVLAN(rm, uint(epgCfg.PktTag))
if err != nil {
return err
}
log.Debugf("Freed vlan %v\n", epgCfg.PktTag)
}
}
epgNet := epgCfg.Name + "." + epgCfg.NetworkName + "." + epgCfg.Tenant
err = epgCfg.Clear()
if err != nil {
log.Errorf("error writing epGroup config. Error: %v", err)
return err
}
return deleteDockNet(epgNet)
}