diff options
| author | Rick Harris <rconradharris@gmail.com> | 2011-09-21 17:49:35 -0500 |
|---|---|---|
| committer | Rick Harris <rconradharris@gmail.com> | 2011-09-21 17:49:35 -0500 |
| commit | 57a67cf27a51e6849bff6236f896ecbee6345250 (patch) | |
| tree | 23d0a6f6ae75680ff311a123a837929dfbbe120d /nova/api | |
| parent | be8b40a02858a0f054c96d97a9881a9e3e4a1f49 (diff) | |
| download | nova-57a67cf27a51e6849bff6236f896ecbee6345250.tar.gz nova-57a67cf27a51e6849bff6236f896ecbee6345250.tar.xz nova-57a67cf27a51e6849bff6236f896ecbee6345250.zip | |
Adding OSAPI tests for flavor filtering
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/flavors.py | 11 |
1 files changed, 9 insertions, 2 deletions
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) |
