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 commit d540903463
)
This commit is contained in:
parent
89413ff042
commit
725b37f515
|
@ -126,6 +126,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
|
||||
|
|
|
@ -1455,3 +1455,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