Revision a62a4d20

b/api/images.py
45 45
        d['description'] = image.description
46 46
        if image.sourcevm:
47 47
            d['serverRef'] = image.sourcevm.id
48
        
49
        metadata = {}
50
        for meta in ImageMetadata.objects.filter(image=image):
51
            metadata[meta.meta_key] = meta.meta_value
52
        
53
        if metadata:
54
            d['metadata'] = {'values': metadata}
55
    
48 56
    return d
49 57

  
50 58

  
b/api/templates/image.xml
1
{% spaceless %}
1 2
<?xml version="1.0" encoding="UTF-8"?>
2
<image xmlns="http://docs.openstack.org/compute/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" id="{{ image.id }}" name="{{ image.name }}" serverRef="{{ image.serverRef }}" updated="{{ image.updated }}" created="{{ image.created }}" status="{{ image.status }}" progress="{{ image.progress }}"> </image>
3
<image xmlns="http://docs.openstack.org/compute/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" id="{{ image.id }}" name="{{ image.name }}" serverRef="{{ image.serverRef }}" updated="{{ image.updated }}" created="{{ image.created }}" status="{{ image.status }}" progress="{{ image.progress }}">
4
</image>
5
{% if image.metadata %}
6
<metadata>
7
  {% for key, val in image.metadata.values.items %}
8
  <meta key="{{ key }}">{{ val }}</meta>
9
  {% endfor %}
10
</metadata>
11
{% endif %}
12
{% endspaceless %}
b/api/templates/list_images.xml
3 3
<images xmlns="http://docs.openstack.org/compute/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom">
4 4
  {% for image in images %}
5 5
  <image id="{{ image.id }}" name="{{ image.name }}"{% if detail %} updated="{{ image.updated }}" created="{{ image.created }}" status="{{ image.status }}"{% endif %}>
6
  {% if image.metadata %}
7
  <metadata>
8
    {% for key, val in image.metadata.values.items %}
9
    <meta key="{{ key }}">{{ val }}</meta>
10
    {% endfor %}
11
  </metadata>
12
  {% endif %}
6 13
  </image>
7 14
  {% endfor %}
8 15
</images>
b/api/util.py
96 96
                return resp
97 97
            except Fault, fault:
98 98
                return render_fault(request, fault)
99
            except Exception, e:
99
            except BaseException, e:
100 100
                log.exception('Unexpected error: %s' % e)
101 101
                fault = ServiceUnavailable()
102 102
                return render_fault(request, fault)

Also available in: Unified diff