block_device state attribute evaluated incorrectly

Bug #1027849 reported by Brendan Donegan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Checkbox
Fix Released
High
Brendan Donegan

Bug Description

It has been noticed that sometimes disk tests will run anyway when their requirements should have failed. Some analysis has already been done on this and the situation is:

"If you look at the ResourceMap class and the contents of source in the eval() call, you'll see what is essentially a dictionary of lists of dictionaries... the bit in question looks like this:

{'block_device':[{'name':'sdb','state':'removalbe'},{'name':'sda','state':'internal'}]}

I was able to get the eval to return false instead of true when I changed the requirements to this:

block_device[0]['name'] == 'sdb' and block_device[0]['state'] != 'removable'

Obviously, this is not a fix, but does highlight what I think the issue is. I think it's returning true becuase in my test case, an object corresponding to 'name' in block_device IS sdb, AND an object corresponding to 'state' IS 'removable'. It's just not the right objects.

So I think eval() is looking through the entire contents of block_device for a match, rather than looking for something that contains name:sdb AND state 'other than removable'. "

This sums up pretty nicely that the 'state' attribute is not strongly tied to the device itself. The eval call will look at all the items in the block_device resource when determining if there is an item with state != removable

Related branches

Changed in checkbox:
assignee: nobody → Brendan Donegan (brendan-donegan)
status: New → In Progress
importance: Undecided → High
Changed in checkbox:
status: In Progress → Fix Committed
Changed in checkbox:
status: Fix Committed → 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.