metadata definition property show should handle type specific prefix
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Glance |
Fix Released
|
Medium
|
Unassigned | ||
Glance Client |
Invalid
|
Medium
|
Unassigned |
Bug Description
metadata definition property show should handle type specific prefix
The metadata definitions API supports listing namespaces by resource type. For example, you can list only namespaces applicable to images by specifying OS::Glance::Image
The API also support showing namespace properties for a specific resource type. The API will automatically prepend any prefix specific to that resource type. For example, in the OS::Compute:
However, if you then ask the API to show the property with the prefix, it will return a "not found" error. To actually see the details of the property, you have to know the base property (without the prefix). It would be nice if the API would attempt to auto-resolve any automatically prefixed properties when showing a property.
This is evident from the command line. If you look at the below interactions, you will see the namespaces listed, then limited to a particular resource type, then the properties shown for the namespace, and then a failure to show the property using the automatically prepended prefix.
* Apologize for formatting.
$ glance --os-image-
+------
| namespace |
+------
| OS::Compute::VMware |
| OS::Compute::XenAPI |
| OS::Compute::Quota |
| OS::Compute:
| OS::Compute:
| OS::Compute:
| OS::Compute:
| OS::Compute::Trust |
| OS::Compute:
| OS::Glance:
| OS::Compute:
+------
$ glance --os-image-
+------
| namespace |
+------
| OS::Compute::VMware |
| OS::Compute::XenAPI |
| OS::Compute:
| OS::Compute:
| OS::Compute:
| OS::Compute:
+------
$ glance --os-image-
+------
| Property | Value |
+------
| created_at | 2014-09-
| description | This provides the preferred socket/core/thread counts for the virtual CPU |
| | instance exposed to guests. This enables the ability to avoid hitting |
| | limitations on vCPU topologies that OS vendors place on their products. See |
| | also: http://
| | driver-
| display_name | Virtual CPU Topology |
| namespace | OS::Compute:
| owner | admin |
| properties | ["hw_cpu_cores", "hw_cpu_sockets", "hw_cpu_
| | "hw_cpu_maxcores", "hw_cpu_
| protected | True |
| resource_
| schema | /v2/schemas/
| visibility | public |
+------
ttripp@
Request returned failure status 404.
<html>
<head>
<title>404 Not Found</title>
</head>
<body>
<h1>404 Not Found</h1>
Could not find property hw_cpu_cores<br /><br />
</body>
</html> (HTTP 404)
ttripp@
+------
| Property | Value |
+------
| description | Preferred number of cores to expose to the guest. |
| name | cpu_cores |
| title | vCPU Cores |
| type | integer |
+------
Changed in glance: | |
assignee: | nobody → Pawel Koniszewski (pawel-koniszewski) |
status: | New → In Progress |
Changed in python-glanceclient: | |
assignee: | nobody → Pawel Koniszewski (pawel-koniszewski) |
tags: | added: metadef |
Changed in glance: | |
assignee: | Pawel Koniszewski (pawel-koniszewski) → Bartosz Fic (bartosz-fic) |
Changed in python-glanceclient: | |
assignee: | Pawel Koniszewski (pawel-koniszewski) → Bartosz Fic (bartosz-fic) |
tags: | added: juno-rc-potential |
Changed in glance: | |
importance: | Undecided → Medium |
Changed in python-glanceclient: | |
importance: | Undecided → Medium |
Changed in glance: | |
milestone: | none → juno-rc2 |
tags: | removed: juno-rc-potential |
Changed in glance: | |
milestone: | juno-rc2 → 2014.2 |
Changed in python-glanceclient: | |
assignee: | Bartosz Fic (bartosz-fic) → nobody |
Changed in glance: | |
assignee: | Bartosz Fic (bartosz-fic) → nobody |
Travis,
I have analyzed things a bit here and I want to propose another solution which is clearer to me.
What you suggested is that after doing this: api-version 2 md-namespace-show OS::Compute: :VirtCPUTopolog y --resource-type OS::Glance::Image
glance --os-image-
You want to do this: api-version 2 md-property-show OS::Compute: :VirtCPUTopolog y hw_cpu_cores
glance --os-image-
The problem I see there is that such calls are inconsistent. In the first command you ask for namespace with specific resource type, but in another request you just want property without specifying resource type. I would say that 404 in this case is correct result.
Instead of resolving errors on the API side (possible name conflicts. a lot of DB calls to determine which property should be returned) my proposition is to add optional argument '--resource-type' to md_property_show command and extend API to handle such argument in URL. Previous calls changed to new way:
glance --os-image- api-version 2 md-namespace-show OS::Compute: :VirtCPUTopolog y --resource-type OS::Glance::Image api-version 2 md-property-show OS::Compute: :VirtCPUTopolog y --resource-type OS::Glance::Image hw_cpu_cores
glance --os-image-
This keeps consistency across every call, you can keep asking for properties associated to specific resource type the same way that you can do it with namespaces.
I will appreciate every comment, thanks!