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 (cherry picked from commit4fbacf1df1
) (cherry picked from commit59a0c147df
)
This commit is contained in:
parent
783c0777e8
commit
21d5b1b209
|
@ -40,6 +40,7 @@ from oslo_utils import excutils
|
|||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from sqlalchemy import and_
|
||||
from sqlalchemy import MetaData
|
||||
from sqlalchemy import or_
|
||||
from sqlalchemy.orm import joinedload
|
||||
|
@ -2002,8 +2003,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