本文整理匯總了Golang中github.com/contiv/netplugin/netplugin/plugin.NetPlugin.AddMaster方法的典型用法代碼示例。如果您正苦於以下問題:Golang NetPlugin.AddMaster方法的具體用法?Golang NetPlugin.AddMaster怎麽用?Golang NetPlugin.AddMaster使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/contiv/netplugin/netplugin/plugin.NetPlugin
的用法示例。
在下文中一共展示了NetPlugin.AddMaster方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: addMaster
// Add a master node
func addMaster(netplugin *plugin.NetPlugin, srvInfo core.ServiceInfo) error {
// save it in db
masterDB[masterKey(srvInfo)] = &srvInfo
// tell the plugin about the master
return netplugin.AddMaster(srvInfo)
}
示例2: addMaster
// Add a master node
func addMaster(netplugin *plugin.NetPlugin, srvInfo objdb.ServiceInfo) error {
// save it in db
MasterDB[masterKey(srvInfo)] = &srvInfo
// tell the plugin about the master
return netplugin.AddMaster(core.ServiceInfo{
HostAddr: srvInfo.HostAddr,
Port: netmasterRPCPort,
})
}
示例3: addMaster
// Add a master node
func addMaster(netplugin *plugin.NetPlugin, srvInfo objdb.ServiceInfo) error {
// save it in db
masterDB[masterKey(srvInfo)] = &srvInfo
// tell the plugin about the master
return netplugin.AddMaster(core.ServiceInfo{
HostAddr: srvInfo.HostAddr,
Port: ofnet.OFNET_MASTER_PORT,
})
}
示例4: processGlobalFwdModeUpdEvent
func processGlobalFwdModeUpdEvent(netPlugin *plugin.NetPlugin, opts core.InstanceInfo, fwdMode string) {
// parse store URL
parts := strings.Split(opts.DbURL, "://")
if len(parts) < 2 {
log.Fatalf("Invalid cluster-store-url %s", opts.DbURL)
}
stateStore := parts[0]
// initialize the config
pluginConfig := plugin.Config{
Drivers: plugin.Drivers{
Network: "ovs",
State: stateStore,
},
Instance: opts,
}
pluginConfig.Instance.FwdMode = fwdMode
netPlugin.GlobalFwdModeUpdate(pluginConfig)
for _, master := range cluster.MasterDB {
netPlugin.AddMaster(core.ServiceInfo{
HostAddr: master.HostAddr,
Port: 9001, //netmasterRPCPort
})
}
serviceList, _ := cluster.ObjdbClient.GetService("netplugin")
for _, serviceInfo := range serviceList {
if serviceInfo.HostAddr != opts.VtepIP {
netPlugin.AddPeerHost(core.ServiceInfo{
HostAddr: serviceInfo.HostAddr,
Port: 4789, //vxlanUDPPort
})
}
}
}