diff options
| author | Brian Waldon <bcwaldon@gmail.com> | 2012-01-12 22:50:32 -0800 |
|---|---|---|
| committer | Brian Waldon <bcwaldon@gmail.com> | 2012-01-16 09:52:03 -0800 |
| commit | 6e7e3870a4ca047185ba5e3320d63afaa08357b8 (patch) | |
| tree | cba1155d9efddeae9086230028e5d2de0af0fc5c /nova/api | |
| parent | 1e9e1f6df643b8d910af3592aa3c541c3f62df45 (diff) | |
Increase robustness of image filtering by server
* fix bug 912837
* fix bug 912927
* filter images based on instance_uuid rather than instance_ref
* stop adding instance_ref to snapshot properties
Change-Id: I5eed1611b1e885553d0c91380e414e9476dc251c
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/images.py | 11 | ||||
| -rw-r--r-- | nova/api/openstack/compute/servers.py | 5 |
2 files changed, 11 insertions, 5 deletions
diff --git a/nova/api/openstack/compute/images.py b/nova/api/openstack/compute/images.py index 194c5071e..fed326f66 100644 --- a/nova/api/openstack/compute/images.py +++ b/nova/api/openstack/compute/images.py @@ -24,6 +24,7 @@ from nova import exception from nova import flags import nova.image from nova import log +import nova.utils LOG = log.getLogger('nova.api.openstack.compute.images') @@ -33,7 +34,7 @@ SUPPORTED_FILTERS = { 'name': 'name', 'status': 'status', 'changes-since': 'changes-since', - 'server': 'property-instance_ref', + 'server': 'property-instance_uuid', 'type': 'property-image_type', 'minRam': 'min_ram', 'minDisk': 'min_disk', @@ -118,6 +119,14 @@ class Controller(wsgi.Controller): # map filter name or carry through if property-* filter_name = SUPPORTED_FILTERS.get(param, param) filters[filter_name] = req.params.get(param) + + # ensure server filter is the instance uuid + filter_name = 'property-instance_uuid' + try: + filters[filter_name] = filters[filter_name].rsplit('/', 1)[1] + except (AttributeError, IndexError, KeyError): + pass + return filters @wsgi.serializers(xml=ImageTemplate) diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index e90e30b7d..3a0cc3683 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -1069,10 +1069,7 @@ class Controller(wsgi.Controller): msg = _("Malformed createImage entity") raise exc.HTTPBadRequest(explanation=msg) - # preserve link to server in image properties - server_ref = os.path.join(req.application_url, 'servers', id) - props = {'instance_ref': server_ref} - + props = {} metadata = entity.get('metadata', {}) common.check_img_metadata_quota_limit(context, metadata) try: |
