File tree Expand file tree Collapse file tree 1 file changed +7
-22
lines changed
Expand file tree Collapse file tree 1 file changed +7
-22
lines changed Original file line number Diff line number Diff line change @@ -80,30 +80,15 @@ func (c *controller) getStores() []datastore.DataStore {
8080}
8181
8282func (c * controller ) getNetworkFromStore (nid string ) (* network , error ) {
83- for _ , store := range c .getStores () {
84- n := & network {id : nid , ctrlr : c }
85- err := store .GetObject (datastore .Key (n .Key ()... ), n )
86- // Continue searching in the next store if the key is not found in this store
87- if err != nil {
88- if err != datastore .ErrKeyNotFound {
89- logrus .Debugf ("could not find network %s: %v" , nid , err )
90- }
91- continue
92- }
93-
94- ec := & endpointCnt {n : n }
95- err = store .GetObject (datastore .Key (ec .Key ()... ), ec )
96- if err != nil && ! n .inDelete {
97- return nil , fmt .Errorf ("could not find endpoint count for network %s: %v" , n .Name (), err )
98- }
99-
100- n .epCnt = ec
101- if n .scope == "" {
102- n .scope = store .Scope ()
83+ ns , err := c .getNetworksFromStore ()
84+ if err != nil {
85+ return nil , err
86+ }
87+ for _ , n := range ns {
88+ if n .id == nid {
89+ return n , nil
10390 }
104- return n , nil
10591 }
106-
10792 return nil , fmt .Errorf ("network %s not found" , nid )
10893}
10994
You can’t perform that action at this time.
0 commit comments