本文整理汇总了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
})
}
}
}