本文整理汇总了Golang中github.com/contiv/netplugin/plugin.NetPlugin.DeleteNetwork方法的典型用法代码示例。如果您正苦于以下问题:Golang NetPlugin.DeleteNetwork方法的具体用法?Golang NetPlugin.DeleteNetwork怎么用?Golang NetPlugin.DeleteNetwork使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/contiv/netplugin/plugin.NetPlugin
的用法示例。
在下文中一共展示了NetPlugin.DeleteNetwork方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: processNetEvent
func processNetEvent(netPlugin *plugin.NetPlugin, netID string,
isDelete bool) (err error) {
// take a lock to ensure we are programming one event at a time.
// Also network create events need to be processed before endpoint creates
// and reverse shall happen for deletes. That order is ensured by netmaster,
// so we don't need to worry about that here
netPlugin.Lock()
defer func() { netPlugin.Unlock() }()
operStr := ""
if isDelete {
err = netPlugin.DeleteNetwork(netID)
operStr = "delete"
} else {
err = netPlugin.CreateNetwork(netID)
operStr = "create"
}
if err != nil {
log.Errorf("Network operation %s failed. Error: %s", operStr, err)
} else {
log.Infof("Network operation %s succeeded", operStr)
}
return
}