Error in logic to retrieve image details in image_valid_on_flavor

Bug #1538341 reported by Kyle Jorgensen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Rally
Fix Released
Undecided
Unassigned

Bug Description

After upgrading to Rally version 0.1.2, running NovaServers.boot_and_delete_server scenario produced the following error:

----
2016-01-26 01:19:22.839 19584 ERROR rally.task.scenario [-] 'min_ram'
2016-01-26 01:19:22.839 19584 ERROR rally.task.scenario Traceback (most recent call last):
2016-01-26 01:19:22.839 19584 ERROR rally.task.scenario File "/usr/lib/python2.6/site-packages/rally/task/scenario.py", line 116, in _validate_helper
2016-01-26 01:19:22.839 19584 ERROR rally.task.scenario deployment=deployment)
2016-01-26 01:19:22.839 19584 ERROR rally.task.scenario File "/usr/lib/python2.6/site-packages/rally/task/validation.py", line 64, in wrap_validator
2016-01-26 01:19:22.839 19584 ERROR rally.task.scenario return (fn(config, clients, deployment, *args, **kwargs) or
2016-01-26 01:19:22.839 19584 ERROR rally.task.scenario File "/usr/lib/python2.6/site-packages/rally/task/validation.py", line 352, in image_valid_on_flavor
2016-01-26 01:19:22.839 19584 ERROR rally.task.scenario if flavor.ram < (image["min_ram"] or 0):
2016-01-26 01:19:22.839 19584 ERROR rally.task.scenario KeyError: 'min_ram'
2016-01-26 01:19:22.839 19584 ERROR rally.task.scenario

Task config is invalid: `Input task is invalid!

Subtask NovaServers.boot_and_delete_server[0] has wrong configuration\Subtask configuration:
{'runner': {'type': 'constant', 'concurrency': 1, 'times': 1}, 'args': {'nics': [{'net-id': '42a02ea4-971c-459a-ac22-4cce38b98cee'}], 'flavor': {'name': 'm2.small'}, 'image': {'name': 'cirros'}}, 'sla': {'failure_rate': {'max': 10}}}

Reason:
 Invalid scenario argument: ''min_ram''
----

After asking on #openstack-rally IRC channel, boris-42 suggested the following solution http://irclog.perlgeek.de/openstack-rally/2016-01-26#i_11940881

This 'image' variable is a dictionary and when the key "min_ram", "size", or "min_disk" does not exist, it throws a 'KeyError'. To fix this, we can use the get() method on the 'image' dictionary.

Changed in rally:
status: New → Confirmed
description: updated
Revision history for this message
Kyle Jorgensen (kyle-jorgensen) wrote :

Andrey Kurilin, thanks for fixing my typo regarding the Rally version, sorry for the mix up :)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to rally (master)

Reviewed: https://review.openstack.org/272865
Committed: https://git.openstack.org/cgit/openstack/rally/commit/?id=11e584b12fa16c739a03a0f4c39f942a01f50e90
Submitter: Jenkins
Branch: master

commit 11e584b12fa16c739a03a0f4c39f942a01f50e90
Author: Kyle Jorgensen <email address hidden>
Date: Tue Jan 26 17:04:15 2016 -0800

    Ensure image['..'] does not throw KeyError

    In the image_valid_on_flavor method, the image variable is a dictionary,
    so when trying to access image['min_ram'] if 'min_ram' does not
    exist then python throws a KeyError. To prevent this from happening,
    default values are assigned to the keys in the image dictionary.
    The corresponding unit test has been updated to check for these
    default values, and invalid tests have now been removed.

    Original solution was suggested by Boris Pavlovic on IRC:
        http://irclog.perlgeek.de/openstack-rally/2016-01-26\#i_11940881

    Updated solution was suggested by Roman Vasilets

    Change-Id: I4fdf926d483d253831ba39400983b5138886fc32
    Closes-bug: #1538341

Changed in rally:
status: Confirmed → Fix Released
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.