table columns can have inconsistent ordering

Bug #1811101 reported by Chris Dent
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
placement-osc-plugin
Invalid
Undecided
Unassigned

Bug Description

When making a request to show inventory, with osc-placement 1.3.0 the columns are shown with different order:

-=-=-
jarvis@localhost:/etc/nova$ openstack resource provider inventory list 4db5cbc1-21f5-41e1-9af7-b5161f653053
/usr/local/lib/python3.5/dist-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
  """)
+----------------+-------+----------+----------+------------------+----------+-----------+
| resource_class | total | max_unit | min_unit | allocation_ratio | reserved | step_size |
+----------------+-------+----------+----------+------------------+----------+-----------+
| DISK_GB | 292 | 291 | 1 | 1.0 | 0 | 1 |
| MEMORY_MB | 32767 | 32767 | 1 | 1.5 | 512 | 1 |
| VCPU | 8 | 8 | 1 | 16.0 | 0 | 1 |
+----------------+-------+----------+----------+------------------+----------+-----------+
jarvis@localhost:/etc/nova$ openstack resource provider inventory list 21c6a1e5-c181-44b3-b568-05e99ed813df
/usr/local/lib/python3.5/dist-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
  """)
+----------------+----------+------------------+----------+-------+-----------+----------+
| resource_class | min_unit | allocation_ratio | reserved | total | step_size | max_unit |
+----------------+----------+------------------+----------+-------+-----------+----------+
| MEMORY_MB | 1 | 1.5 | 512 | 32767 | 1 | 32767 |
| VCPU | 1 | 16.0 | 0 | 8 | 1 | 8 |
| DISK_GB | 1 | 1.0 | 0 | 292 | 1 | 291 |
+----------------+----------+------------------+----------+-------+-----------+----------+
-=-=-

This is disconcerting and disorienting. Presumably total should come after resource_class and then the rest can be bikeshedded.

Revision history for this message
Matt Riedemann (mriedem) wrote :

Looks like you were on a py35 host, I'm having a hard time reproducing this on a py27 host, but this would likely be the issue - these keys are not sorted and coming from a dict:

https://github.com/openstack/osc-placement/blob/ffc2ee4c09089baa65702abb6926a62f2cdf9996/osc_placement/resources/inventory.py#L67

https://github.com/openstack/osc-placement/blob/ffc2ee4c09089baa65702abb6926a62f2cdf9996/osc_placement/resources/inventory.py#L316

It would be easy enough to sort those fields but yeah if you want total to come after resource_class that's a bit more tricky.

I also tried using --sort-column but it doesn't seem to have an effect:

stack@train:~$ openstack resource provider inventory list dbe783b2-8780-4bef-a758-d7a853118e25 --sort-column total
+----------------+------------------+----------+----------+-----------+----------+-------+
| resource_class | allocation_ratio | max_unit | reserved | step_size | min_unit | total |
+----------------+------------------+----------+----------+-----------+----------+-------+
| VCPU | 16.0 | 8 | 0 | 1 | 1 | 8 |
| DISK_GB | 1.0 | 193 | 0 | 1 | 1 | 193 |
| MEMORY_MB | 1.5 | 7975 | 512 | 1 | 1 | 7975 |
+----------------+------------------+----------+----------+-----------+----------+-------+

Revision history for this message
Matt Riedemann (mriedem) wrote :
Changed in placement-osc-plugin:
status: New → Invalid
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.