GET /v2/images/UUID can't handle metadata with extra properties
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Glance |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Summary
=======
On cinder folsom-3, create-
Error Message (cinder-volume)
=======
[-] Exception during message handling
Traceback (most recent call last):
File "/usr/local/
rval = self.proxy.
File "/usr/local/
return getattr(proxyobj, method)(ctxt, **kwargs)
File "/usr/local/
volume_
File "/usr/lib/
self.gen.next()
File "/usr/local/
image_location = image_service.
File "/usr/local/
_reraise_
File "/usr/local/
image_meta = client.
File "/usr/local/
return getattr(
File "/usr/local/
return self.model(**body)
File "/usr/local/
raise ValueError()
ValueError
tcpick log (port 9292)
=======
JSON schema
-----------
GET /v2/schemas/image HTTP/1.1
Host: 127.0.0.1:9292
Accept-Encoding: identity
X-Auth-Token: 5dbbea713c5a4e0
Content-Type: application/json
User-Agent: python-glanceclient
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 2156
X-Openstack-
Date: Tue, 21 Aug 2012 15:42:57 GMT
{"additionalPro
"rel": "enclosure"}, {"href": "{schema}", "rel": "describedby"}], "properties": {"status": {"enum": ["queued", "saving", "ac
tive", "killed", "deleted", "pending_delete"], "type": "string", "description": "Status of the image"}, "format": {"required"
: true, "type": "string", "description": "The format code for the image", "enum": ["raw", "vhd", "vmdk", "vdi", "qcow2", "qed
"]}, "name": {"type": "string", "description": "Descriptive name for the image", "maxLength": 255}, "tags": {"items": {"type"
: "string", "maxLength": 255}, "type": "array", "description": "List of strings related to the image"}, "checksum": {"type":
"string", "description": "md5 hash of image contents.", "maxLength": 32}, "created_at": {"type": "string", "description": "Da
te and time of image registration"}, "size": {"type": "integer", "description": "Size of image file in bytes"}, "disk_format"
: {"enum": ["raw", "vhd", "vmdk", "vdi", "iso", "qcow2", "aki", "ari", "ami"], "type": "string", "description": ""}, "updated
_at": {"type": "string", "description": "Date and time of the last image modification"}, "visibility": {"enum": ["public", "p
rivate"], "type": "string", "description": "Scope of image accessibility"}, "id": {"type": "string", "description": "An ident
ifier for the image", "maxLength": 36}, "protected": {"type": "boolean", "description": "If true, image will not be deletable
."}, "min_ram": {"type": "integer", "description": "Amount of ram (in MB) required to boot image."}, "file": {"type": "string"}, "container_format": {"enum": ["bare", "ovf", "ami", "aki", "ari"], "type": "string", "description": ""}, "min_disk": {"type": "integer", "description": "Amount of disk space (in GB) required to boot image."}, "direct_url": {"type": "string", "description": "URL to access the image file kept in external store"}, "type": {"required": true, "type": "string", "description": "The type code for the image", "enum": ["kernel", "ramdisk", "filesystem", "iso9660", "disk"]}, "self": {"type": "string"}, "schema": {"type": "string"}}}
Image metadata
--------------
GET /v2/images/
Host: 127.0.0.1:9292
Accept-Encoding: identity
X-Auth-Token: 5dbbea713c5a4e0
Content-Type: application/json
User-Agent: python-glanceclient
HTTP/1.1 200 OK
Content-Length: 627
Content-Type: application/json; charset=UTF-8
X-Openstack-
Date: Tue, 21 Aug 2012 15:42:57 GMT
{"status": "active", "name": "centos.5-3", "tags": [], "kernel_id": "f01fb9ab-
---
The schema doesn't have definitions for "kernel_id" and "ramdisk_id", so that validation failed.
Related commit
==============
* Add 'explain' command to v2 that describes schemas
7f48506781ea1
* Replace static v2 Image model with warlock model
c398af18b0b8f
Solution
========
I think there are solutions:
a) Add kernel_id, ramdisk_id and other extra properties to schema.
b) Add 'extra_properties' to schema and make them its sub-properties.
c) Remove extra properties from result of that GET request.
Extra solution
=============
d) Add extra definitions to /etc/glance/ schema- image.json.
I'm using this.
{
"description" : "An identifier for the linked kernel image",
"maxLength" : 36,
"description" : "An identifier for the linked ramdisk image",
"maxLength" : 36,
"kernel_id": {
"type": "string",
"required": false
},
"ramdisk_id": {
"type": "string",
"required": false
}
}