From 57a67cf27a51e6849bff6236f896ecbee6345250 Mon Sep 17 00:00:00 2001 From: Rick Harris Date: Wed, 21 Sep 2011 17:49:35 -0500 Subject: Adding OSAPI tests for flavor filtering --- nova/api/openstack/flavors.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/flavors.py b/nova/api/openstack/flavors.py index 0fd31abb5..b9dd96f4e 100644 --- a/nova/api/openstack/flavors.py +++ b/nova/api/openstack/flavors.py @@ -45,9 +45,16 @@ class Controller(object): """Helper function that returns a list of flavor dicts.""" filters = {} if 'minRam' in req.params: - filters['min_memory_mb'] = req.params['minRam'] + try: + filters['min_memory_mb'] = int(req.params['minRam']) + except ValueError: + pass # ignore bogus values per spec + if 'minDisk' in req.params: - filters['min_local_gb'] = req.params['minDisk'] + try: + filters['min_local_gb'] = int(req.params['minDisk']) + except ValueError: + pass # ignore bogus values per spec ctxt = req.environ['nova.context'] inst_types = db.api.instance_type_get_all(ctxt, filters=filters) -- cgit