@@ -33,7 +33,7 @@ func (s *Server) listBranches(w http.ResponseWriter, r *http.Request) {
33
33
return
34
34
}
35
35
36
- branches , err := fsm . ListAllBranches ( )
36
+ branches , err := s . getAllAvailableBranches ( fsm )
37
37
if err != nil {
38
38
api .SendBadRequestError (w , r , err .Error ())
39
39
return
@@ -85,6 +85,21 @@ func (s *Server) listBranches(w http.ResponseWriter, r *http.Request) {
85
85
}
86
86
}
87
87
88
+ func (s * Server ) getAllAvailableBranches (fsm pool.FSManager ) ([]models.BranchEntity , error ) {
89
+ if fsm == nil {
90
+ return nil , fmt .Errorf ("no available pools" )
91
+ }
92
+
93
+ // Filter by available pools in case if two or more DLE is running on the same pool and use the selectedPool feature.
94
+ poolNames := []string {}
95
+
96
+ for _ , fsManager := range s .pm .GetFSManagerList () {
97
+ poolNames = append (poolNames , fsManager .Pool ().Name )
98
+ }
99
+
100
+ return fsm .ListAllBranches (poolNames )
101
+ }
102
+
88
103
func findBranchParent (snapshots map [string ]models.SnapshotDetails , parentID , branch string ) (int , string ) {
89
104
snapshotCounter := 0
90
105
@@ -121,13 +136,13 @@ func containsString(slice []string, s string) bool {
121
136
}
122
137
123
138
func (s * Server ) getFSManagerForBranch (branchName string ) (pool.FSManager , error ) {
124
- allBranches , err := s .pm .First (). ListAllBranches ( )
139
+ allBranches , err := s .getAllAvailableBranches ( s . pm .First ())
125
140
if err != nil {
126
141
return nil , fmt .Errorf ("failed to get branch list: %w" , err )
127
142
}
128
143
129
144
for _ , branchEntity := range allBranches {
130
- if branchEntity .Name == branchName {
145
+ if branchEntity .Name == branchName { // TODO: filter by pool name as well because branch name is ambiguous.
131
146
return s .getFSManagerForSnapshot (branchEntity .SnapshotID )
132
147
}
133
148
}
0 commit comments