host API has inconsistent host name attribute

Bug #1390498 reported by Russell Sim
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Won't Fix
Wishlist
jichenjc

Bug Description

When doing a list with the os-host extension the host name attribute is host_name in all other cases the host name attribute is host.

E.g. when doing a list operation a result like this is expected:

{"hosts": [
  {"zone": "internal", "host_name": "awesome-node1", "service": "compute"}]}

When doing a describe of the same host:

{"host": [{"resource": {"project": "(total)", "memory_mb": 193278, "host": "awesome-node1", "cpu": 48, "disk_gb": 98}},
          {"resource": {"project": "(used_now)", "memory_mb": 13312, "host": "awesome-node1", "cpu": 6, "disk_gb": 20}},
          {"resource": {"project": "(used_max)", "memory_mb": 12288, "host": "awesome-node1", "cpu": 6, "disk_gb": 20}},
          {"resource": {"project": "de59ee29134b4980bbb77608347ae08a", "memory_mb": 12288, "host": "awesome-node1", "cpu": 6, "disk_gb": 20}}]}

This is confusing at best.

It has already caused some problems in the official client library.

https://github.com/openstack/python-novaclient/commit/9ce03a98eb78652fd3480cb0d8323520fd78064c
https://github.com/openstack/python-novaclient/commit/73a0e7298aeb7ff43e70a865d2350923d269db69

Tags: api
description: updated
Revision history for this message
Alex Xu (xuhj) wrote :

We can't fix it now for back-compabitility. But we may can doing this when we have micro-version in API

tags: added: api
Changed in nova:
importance: Undecided → Wishlist
Joe Gordon (jogo)
Changed in nova:
status: New → Confirmed
Revision history for this message
Russell Sim (russell-sim) wrote :

Cool, so what is the prefered name of the attribute? host_name?

This will need to be fixed in the client for the timebeing so it would be good if there was some decision regarding which is the better name.

Revision history for this message
jichenjc (jichenjc) wrote :

I prefer to use 'host' because of less change

and FYI, the microversion is still under development, I plan to submit a patch when it's done

Changed in nova:
assignee: nobody → jichenjc (jichenjc)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/144995

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
jichenjc (jichenjc) wrote :

I guess it won't be fixed because
https://review.openstack.org/#/c/144995/

got following comments,

Honestly, I don't think this kind of change is worth the incompatibility. It provides no new features, only consistency, in a way that most consumers won't really care about.

I also think methodologically it does this the wrong way by decorating a private method with the api version dispatch. Which we shouldn't be doing.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by jichenjc (<email address hidden>) on branch: master
Review: https://review.openstack.org/144995
Reason: no need this change

Changed in nova:
status: In Progress → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.