← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1367564] Re: metadata definition property show should handle type specific prefix

 

Reviewed:  https://review.openstack.org/127248
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=6b0c7ed29ec1e716e704e19112d9ee24553faf19
Submitter: Jenkins
Branch:    proposed/juno

commit 6b0c7ed29ec1e716e704e19112d9ee24553faf19
Author: Bartosz Fic <bartosz.fic@xxxxxxxxx>
Date:   Wed Oct 8 10:47:31 2014 +0200

    GET property which name includes resource type prefix
    
    Currently GET call to API to retrieve property details ends with
    404 error when property name includes resource type prefix.
    This patch extends show method to take filters as a parameter.
    If 'resource_type' is included in filters then the prefix of included
    resource type is removed from property name. This enables user to look
    for property name starting with prefix that comes from associated
    resource type.
    
    Change-Id: I3c4d96fbc9ce15016631017bf76089c338ac3cdc
    Closes-Bug: #1367564
    DocImpact
    Co-Authored-By: Bartosz Fic <bartosz.fic@xxxxxxxxx>
    Co-Authored-By: Pawel Koniszewski <pawel.koniszewski@xxxxxxxxx>


** Changed in: glance
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1367564

Title:
  metadata definition property show should handle type specific prefix

Status in OpenStack Image Registry and Delivery Service (Glance):
  Fix Released
Status in Python client library for Glance:
  In Progress

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::VirtCPUTopology namespace, the properties will come back
  with "hw_" prepended.

  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-api-version 2 md-namespace-list
  +------------------------------------+
  | namespace                          |
  +------------------------------------+
  | OS::Compute::VMware                |
  | OS::Compute::XenAPI                |
  | OS::Compute::Quota                 |
  | OS::Compute::Libvirt               |
  | OS::Compute::Hypervisor            |
  | OS::Compute::Watchdog              |
  | OS::Compute::HostCapabilities      |
  | OS::Compute::Trust                 |
  | OS::Compute::VirtCPUTopology       |
  | OS::Glance:CommonImageProperties   |
  | OS::Compute::RandomNumberGenerator |
  +------------------------------------+

  $ glance --os-image-api-version 2 md-namespace-list --resource-type OS::Glance::Image
  +------------------------------+
  | namespace                    |
  +------------------------------+
  | OS::Compute::VMware          |
  | OS::Compute::XenAPI          |
  | OS::Compute::Libvirt         |
  | OS::Compute::Hypervisor      |
  | OS::Compute::Watchdog        |
  | OS::Compute::VirtCPUTopology |
  +------------------------------+

  $ glance --os-image-api-version 2 md-namespace-show OS::Compute::VirtCPUTopology --resource-type OS::Glance::Image
  +----------------------------+----------------------------------------------------------------------------------+
  | Property                   | Value                                                                            |
  +----------------------------+----------------------------------------------------------------------------------+
  | created_at                 | 2014-09-10T02:55:40Z                                                             |
  | 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://git.openstack.org/cgit/openstack/nova-specs/tree/specs/juno/virt-   |
  |                            | driver-vcpu-topology.rst                                                         |
  | display_name               | Virtual CPU Topology                                                             |
  | namespace                  | OS::Compute::VirtCPUTopology                                                     |
  | owner                      | admin                                                                            |
  | properties                 | ["hw_cpu_cores", "hw_cpu_sockets", "hw_cpu_maxsockets", "hw_cpu_threads",        |
  |                            | "hw_cpu_maxcores", "hw_cpu_maxthreads"]                                          |
  | protected                  | True                                                                             |
  | resource_type_associations | ["OS::Glance::Image", "OS::Cinder::Volume", "OS::Nova::Flavor"]                  |
  | schema                     | /v2/schemas/metadefs/namespace                                                   |
  | visibility                 | public                                                                           |
  +----------------------------+----------------------------------------------------------------------------------+

  ttripp@ubuntu:/opt/stack/glance$ glance --os-image-api-version 2 md-property-show OS::Compute::VirtCPUTopology hw_cpu_cores
  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@ubuntu:/opt/stack/glance$ glance --os-image-api-version 2 md-property-show OS::Compute::VirtCPUTopology cpu_cores
  +-------------+---------------------------------------------------+
  | Property    | Value                                             |
  +-------------+---------------------------------------------------+
  | description | Preferred number of cores to expose to the guest. |
  | name        | cpu_cores                                         |
  | title       | vCPU Cores                                        |
  | type        | integer                                           |
  +-------------+---------------------------------------------------+

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1367564/+subscriptions


References