Flavor ID does not have to be an int (and is optional when creating)

Bug #1072961 reported by Russell Cloran
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-novaclient
Invalid
Undecided
Anita Kuno

Bug Description

https://bugs.launchpad.net/nova/+bug/1043410 changes the flavor creation API to make flavor optional; flavorids are now generated as UUIDs.

There is also no validation for the input type in any case.

Creation seems to be, therefore, unnecessarily restrictive of the user, and listing/getting seems not to be permissive enough of the server's response.

Revision history for this message
Russell Cloran (russell) wrote :

It seems that https://review.openstack.org/#/c/14999/ partly addresses this (I can't see a related bug).

Changed in python-novaclient:
assignee: nobody → Russell Cloran (russell)
Revision history for this message
Russell Cloran (russell) wrote :

It seems that change fully addresses this bug

Revision history for this message
Alexey Izbyshev (izbyshev) wrote :

That change completely removed type checking of 'flavorid' argument of FlavorManager.create(). It has already lead to problems because a caller can pass any (even unencodable with JSONEncoder) object as flavorid and get a strange exception instead of usual CommandError. Horizon currenly does exactly that thing -- it passes an UUID (an object, not a string) to api.nova.flavor_create() and gets a TypeError from json module.

While it is an obvious bug in Horizon, it would be good if novaclient does type checking of 'flavorid`. It is currenly stored as `varchar` in nova database, so it would be logical to check that `flavorid` is a string or None (in the latter case it should be auto-generated by nova). I would like to see opinions from more experienced people on this case, in particular, whether such a strict check is acceptable in sense of compatibility (earlier novaclient has accepted an int, and now it effectively accepts any json-encodable type).

Other alternatives are:
  - to check that flavorid is json-encodable
  - to explicitly convert it to string (if it is not None) and thus ensure json-encodability
  - to remove flavorid from arguments as it's done in other `create` functions (it should be generated and returned by nova)

Russell Cloran (russell)
Changed in python-novaclient:
assignee: Russell Cloran (russell) → nobody
Anita Kuno (anteaya)
Changed in python-novaclient:
assignee: nobody → Anita Kuno (akuno)
Revision history for this message
Anita Kuno (anteaya) wrote :

Based on a conversation with vishy in IRC I am asked to close this bug.

Changed in python-novaclient:
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.