Init HostState.failed_builds
If _update_from_compute_node returns early and the HostState is not filtered out we can hit an AttributeError in the BuildFailureWeigher because the failed_builds attribute is not set. This simply initializes the attribute like the other stats fields. Change-Id: I5f8e4d32c6a1d6b61396b4fa11c5d776f432df0c Closes-Bug: #1834691 (cherry picked from commitd540903463
) (cherry picked from commit725b37f515
) (cherry picked from commit5acbea506a
)
This commit is contained in:
parent
2c1596b78f
commit
9bc9567532
|
@ -127,6 +127,7 @@ class HostState(object):
|
|||
# Additional host information from the compute node stats:
|
||||
self.num_instances = 0
|
||||
self.num_io_ops = 0
|
||||
self.failed_builds = 0
|
||||
|
||||
# Other information
|
||||
self.host_ip = None
|
||||
|
|
|
@ -1415,3 +1415,5 @@ class HostStateTestCase(test.NoDBTestCase):
|
|||
# Because compute record not ready, the update of free ram
|
||||
# will not happen and the value will still be 0
|
||||
self.assertEqual(0, host.free_ram_mb)
|
||||
# same with failed_builds
|
||||
self.assertEqual(0, host.failed_builds)
|
||||
|
|
Loading…
Reference in New Issue