Fix Python3 compatibility
Fix Python3 compatibility

In Python 3, dict.items() dict.keys() and dict.values() returns a
Dictionary object which, not supporting indexing, is not a real list. A
real list can be obtained by list(dict.values()). There is no methods
sort() in python3 as plugins.keys() is a dict.

* This patch converts object to list. It works in py2 and py3.
* This patch converts division to truncation division (//) which is
  much faster than floating division. It also normalises the result to int.

Change-Id: I3732a1a6ad3825f2046e5747b72724f7abba2636

redhat-openstack/infrared,redhat-openstack/infrared,redhat-openstack/infrared