Filter shares by share type "extra_specs"
This change fixes the query being used to filter share types. We were using an "or" clause instead of an "and" clause, and that was causing all the extra specs to be shown instead of the ones that the user specified. With this fix, manila users will be able to filter shares by share type extra_specs accurately. Closes-Bug: #1929121 Change-Id: I5cf9788dcafebdf88426617d2824f4be42dbb412
This commit is contained in:
parent
4bfea794d7
commit
4fbacf1df1
@ -42,6 +42,7 @@ from oslo_utils import importutils
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import sqlalchemy
|
||||
from sqlalchemy import and_
|
||||
from sqlalchemy import MetaData
|
||||
from sqlalchemy import or_
|
||||
from sqlalchemy.orm import joinedload
|
||||
@ -2016,8 +2017,8 @@ def _process_share_filters(query, filters, project_id=None, is_public=False):
|
||||
models.ShareTypeExtraSpecs.share_type_id ==
|
||||
models.ShareInstance.share_type_id)
|
||||
for k, v in filters['extra_specs'].items():
|
||||
query = query.filter(or_(models.ShareTypeExtraSpecs.key == k,
|
||||
models.ShareTypeExtraSpecs.value == v))
|
||||
query = query.filter(and_(models.ShareTypeExtraSpecs.key == k,
|
||||
models.ShareTypeExtraSpecs.value == v))
|
||||
|
||||
return query
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Filtering shares by share-type "extra_specs" as
|
||||
key=value now returns the expected output.
|
Loading…
Reference in New Issue
Block a user