Support non-public volume types

- added query-parameters to filter for non-public volume-types. Needs
  ?is_public=None

- added is_public-property to support non-public-volume-types

Change-Id: I3f6cdf3fc4c97584a28c9254b74985d8ecde4719
This commit is contained in:
Tino Schmeier 2018-12-03 16:57:20 +01:00 committed by Monty Taylor
parent 7c1048128e
commit 08dfc169dc
2 changed files with 6 additions and 2 deletions

View File

@ -98,12 +98,12 @@ class Proxy(proxy.Proxy):
"""
return self._get(_type.Type, type)
def types(self):
def types(self, **query):
"""Retrieve a generator of volume types
:returns: A generator of volume type objects.
"""
return self._list(_type.Type, paginated=False)
return self._list(_type.Type, paginated=False, **query)
def create_type(self, **attrs):
"""Create a new type from attributes

View File

@ -24,6 +24,8 @@ class Type(resource.Resource):
allow_delete = True
allow_list = True
_query_mapping = resource.QueryParameters("is_public")
# Properties
#: A ID representing this type.
id = resource.Body("id")
@ -31,3 +33,5 @@ class Type(resource.Resource):
name = resource.Body("name")
#: A dict of extra specifications. "capabilities" is a usual key.
extra_specs = resource.Body("extra_specs", type=dict)
#: a private volume-type. *Type: bool*
is_public = resource.Body('os-volume-type-access:is_public', type=bool)