Comment 1 for bug 1816360

Revision history for this message
yangjie (yang.jie) wrote :

The solution of the bug is extremly simple.
In nova/scheduler/filter_scheduler.py,

        weighed_hosts = self.host_manager.get_weighed_hosts(filtered_hosts,
            spec_obj)
        # Strip off the WeighedHost wrapper class...
        weighed_hosts = [h.obj for h in weighed_hosts]

        LOG.debug("Weighed %(hosts)s", {'hosts': weighed_hosts})

Exchange the last two lines of code, make sure logging the weighed_hosts before we strip off the WeighedHost wrapper class.

Then, the log become to this:
2019-02-18 15:08:50.710 19828 DEBUG nova.scheduler.filter_scheduler [req-26963753-81af-4742-a0cd-b8279bb4905a 8fdccd78f9404ccbb427b0b798f46f67 d8706f56f2314bbb8e62463ba833bb1e - default default] Weighed [WeighedHost [host: (Shelf1Slot3SBCR, Shelf1Slot3SBCR) ram: 12743MB disk: 112640MB io_ops: 0 instances: 0, weight: 1.71508529652], WeighedHost [host: (nail2, nail2) ram: 19919MB disk: 120832MB io_ops: 0 instances: 0, weight: 1.63476368028], WeighedHost [host: (nail1, nail1) ram: 27527MB disk: 226304MB io_ops: 0 instances: 2, weight: -999997.0]] _get_sorted_hosts /usr/lib/python2.7/site-packages/nova/scheduler/filter_scheduler.py:453