@@ -274,7 +274,7 @@ func (stack *OpenstackVolumes) buildOpenstackVolume(d *cinderv2.Volume) (*volume
274
274
return vol , nil
275
275
}
276
276
277
- func (stack * OpenstackVolumes ) matchesTags (d * cinderv2.Volume ) bool {
277
+ func (stack * OpenstackVolumes ) matchesTags (d * cinderv2.Volume , filterByAZ bool ) bool {
278
278
for _ , k := range stack .matchTagKeys {
279
279
_ , found := d .Metadata [k ]
280
280
if ! found {
@@ -290,7 +290,7 @@ func (stack *OpenstackVolumes) matchesTags(d *cinderv2.Volume) bool {
290
290
}
291
291
292
292
// find volume az matching compute az
293
- if ! stack .ignoreAZ {
293
+ if filterByAZ && ! stack .ignoreAZ {
294
294
if d .AvailabilityZone != stack .zone {
295
295
return false
296
296
}
@@ -300,6 +300,10 @@ func (stack *OpenstackVolumes) matchesTags(d *cinderv2.Volume) bool {
300
300
}
301
301
302
302
func (stack * OpenstackVolumes ) FindVolumes () ([]* volumes.Volume , error ) {
303
+ return stack .findVolumes (true )
304
+ }
305
+
306
+ func (stack * OpenstackVolumes ) findVolumes (filterByAZ bool ) ([]* volumes.Volume , error ) {
303
307
var volumes []* volumes.Volume
304
308
305
309
klog .V (2 ).Infof ("Listing Openstack disks in %s/%s" , stack .project , stack .meta .AvailabilityZone )
@@ -316,7 +320,7 @@ func (stack *OpenstackVolumes) FindVolumes() ([]*volumes.Volume, error) {
316
320
}
317
321
318
322
for _ , volume := range vols {
319
- if ! stack .matchesTags (& volume ) {
323
+ if ! stack .matchesTags (& volume , filterByAZ ) {
320
324
continue
321
325
}
322
326
vol , err := stack .buildOpenstackVolume (& volume )
0 commit comments