@@ -148,60 +148,16 @@ func peerDiscoveryLoop(netplugin *plugin.NetPlugin, objdbClient objdb.API, local
148
148
masterEventCh := make (chan objdb.WatchServiceEvent , 1 )
149
149
masterWatchStopCh := make (chan bool , 1 )
150
150
151
- // Start a watch on netplugin service so that we dont miss any
152
- err := objdbClient .WatchService ("netplugin" , nodeEventCh , watchStopCh )
153
- if err != nil {
154
- log .Fatalf ("Could not start a watch on netplugin service. Err: %v" , err )
155
- }
156
-
157
151
// Start a watch on netmaster too
158
- err = objdbClient .WatchService ("netmaster" , masterEventCh , masterWatchStopCh )
152
+ err : = objdbClient .WatchService ("netmaster" , masterEventCh , masterWatchStopCh )
159
153
if err != nil {
160
154
log .Fatalf ("Could not start a watch on netmaster service. Err: %v" , err )
161
155
}
162
156
163
- // Get a list of all existing netplugin nodes
164
- nodeList , err := objdbClient .GetService ("netplugin" )
165
- if err != nil {
166
- log .Errorf ("Error getting node list from objdb. Err: %v" , err )
167
- }
168
-
169
- log .Infof ("Got netplugin service list: %+v" , nodeList )
170
-
171
- // walk each node and add it as a PeerHost
172
- for _ , node := range nodeList {
173
- // Ignore if its our own info
174
- if node .HostAddr == localIP {
175
- continue
176
- }
177
- // add the node
178
- err := netplugin .AddPeerHost (core.ServiceInfo {
179
- HostAddr : node .HostAddr ,
180
- Port : ofnet .OFNET_AGENT_PORT ,
181
- })
182
- if err != nil {
183
- log .Errorf ("Error adding node {%+v}. Err: %v" , node , err )
184
- }
185
- }
186
-
187
- // Get a list of all existing netmasters
188
- masterList , err := objdbClient .GetService ("netmaster" )
157
+ // Start a watch on netplugin service so that we dont miss any
158
+ err = objdbClient .WatchService ("netplugin" , nodeEventCh , watchStopCh )
189
159
if err != nil {
190
- log .Errorf ("Error getting master list from objdb. Err: %v" , err )
191
- }
192
-
193
- log .Infof ("Got netmaster service list: %+v" , masterList )
194
-
195
- // Walk each master and add it
196
- for _ , master := range masterList {
197
- // Add the master
198
- err := addMaster (netplugin , core.ServiceInfo {
199
- HostAddr : master .HostAddr ,
200
- Port : ofnet .OFNET_MASTER_PORT ,
201
- })
202
- if err != nil {
203
- log .Errorf ("Error adding master {%+v}. Err: %v" , master , err )
204
- }
160
+ log .Fatalf ("Could not start a watch on netplugin service. Err: %v" , err )
205
161
}
206
162
207
163
for {
0 commit comments