← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1591434] [NEW] get 'itemNotFound' when flavor-show flavor_name

 

Public bug reported:

when I use 'flavor-show' to get detail info of flavor, novaclient get
"Flavor m1.small could not be found".

1.create m1.small flavor 
  $ nova flavor-list | grep m1.small
  | 2    | m1.small  | 2048      | 20   | 0         |      | 1     | 1.0         | True      |
2.get the detail info of m1.small flavor
  nova --debug flavor-show m1.small
  ...
  RESP BODY: {"itemNotFound": {"message": "Flavor m1.small could not be found.", "code": 404}}
  ...
  +----------------------------+----------+
  | Property                   | Value    |
  +----------------------------+----------+
  | OS-FLV-DISABLED:disabled   | False    |
  | OS-FLV-EXT-DATA:ephemeral  | 0        |
  | disk                       | 20       |
  | extra_specs                | {}       |
  | id                         | 2        |
  | name                       | m1.small |
  | os-flavor-access:is_public | True     |
  | ram                        | 2048     |
  | rxtx_factor                | 1.0      |
  | swap                       |          |
  | vcpus                      | 1        |
  +----------------------------+----------+

reason:
  nova not allow user to get flavor by name. Nova just have get_flavor_by_flavor_id(), and have no get_flavor_by_flavor_name.
-----
def show(self, req, id):
        """Return data about the given flavor id."""
        context = req.environ['nova.context']
        try:
            flavor = flavors.get_flavor_by_flavor_id(id, ctxt=context)#just get_flavor_by_flavor_id
            req.cache_db_flavor(flavor)
        except exception.FlavorNotFound as e:
            raise webob.exc.HTTPNotFound(explanation=e.format_message())

        return self._view_builder.show(req, flavor)
----- 


helpful: Add get_flavor_by_flavor_name() into show()
reason:  novaclient just allow user to create flavor by unique id and unique name, so we can get flavor by the id or name. And we can add get_flavor_by_flavor_name().
-----
Positional arguments:
  <name>                   Unique name of the new flavor.
  <id>                     Unique ID of the new flavor. Specifying 'auto' will
                           generated a UUID for the ID.
-----

** Affects: nova
     Importance: Undecided
     Assignee: PanFengyun (pan-feng-yun)
         Status: New

** Changed in: nova
     Assignee: (unassigned) => PanFengyun (pan-feng-yun)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1591434

Title:
  get 'itemNotFound' when flavor-show  flavor_name

Status in OpenStack Compute (nova):
  New

Bug description:
  when I use 'flavor-show' to get detail info of flavor, novaclient get
  "Flavor m1.small could not be found".

  1.create m1.small flavor 
    $ nova flavor-list | grep m1.small
    | 2    | m1.small  | 2048      | 20   | 0         |      | 1     | 1.0         | True      |
  2.get the detail info of m1.small flavor
    nova --debug flavor-show m1.small
    ...
    RESP BODY: {"itemNotFound": {"message": "Flavor m1.small could not be found.", "code": 404}}
    ...
    +----------------------------+----------+
    | Property                   | Value    |
    +----------------------------+----------+
    | OS-FLV-DISABLED:disabled   | False    |
    | OS-FLV-EXT-DATA:ephemeral  | 0        |
    | disk                       | 20       |
    | extra_specs                | {}       |
    | id                         | 2        |
    | name                       | m1.small |
    | os-flavor-access:is_public | True     |
    | ram                        | 2048     |
    | rxtx_factor                | 1.0      |
    | swap                       |          |
    | vcpus                      | 1        |
    +----------------------------+----------+

  reason:
    nova not allow user to get flavor by name. Nova just have get_flavor_by_flavor_id(), and have no get_flavor_by_flavor_name.
  -----
  def show(self, req, id):
          """Return data about the given flavor id."""
          context = req.environ['nova.context']
          try:
              flavor = flavors.get_flavor_by_flavor_id(id, ctxt=context)#just get_flavor_by_flavor_id
              req.cache_db_flavor(flavor)
          except exception.FlavorNotFound as e:
              raise webob.exc.HTTPNotFound(explanation=e.format_message())

          return self._view_builder.show(req, flavor)
  ----- 

  
  helpful: Add get_flavor_by_flavor_name() into show()
  reason:  novaclient just allow user to create flavor by unique id and unique name, so we can get flavor by the id or name. And we can add get_flavor_by_flavor_name().
  -----
  Positional arguments:
    <name>                   Unique name of the new flavor.
    <id>                     Unique ID of the new flavor. Specifying 'auto' will
                             generated a UUID for the ID.
  -----

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


Follow ups