예제 #1
0
// 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
0
파일: cluster.go 프로젝트: jojimt/netplugin
// 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
0
파일: cluster.go 프로젝트: vvb/netplugin
// 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
0
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
			})
		}
	}

}