Merge "Added image_filter and volume_type_filter"
This commit is contained in:
@@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
import json
|
||||
from cloudcafe.blockstorage.volumes_api.common.config import \
|
||||
VolumesAPIConfig as _VolumesAPIConfig
|
||||
|
||||
@@ -25,3 +25,19 @@ class VolumesAPIConfig(_VolumesAPIConfig):
|
||||
def min_volume_from_image_size(self):
|
||||
"""Limit the smallest size a volume can be if building from an image"""
|
||||
return int(self.get("min_volume_from_image_size", default=1))
|
||||
|
||||
@property
|
||||
def image_filter(self):
|
||||
"""Expects Json. Returns an empty dictionary by default.
|
||||
Dictionary keys should be attributes of the image model, and key values
|
||||
should be a list of values for that model attribute.
|
||||
"""
|
||||
return json.loads(self.get('image_filter', '{}'))
|
||||
|
||||
@property
|
||||
def volume_type_filter(self):
|
||||
"""Expects Json. Returns an empty dictionary by default.
|
||||
Dictionary keys should be attributes of the volume type model, and
|
||||
key values should be a list of values for that model attribute.
|
||||
"""
|
||||
return json.loads(self.get('volume_type_filter', '{}'))
|
||||
|
||||
Reference in New Issue
Block a user