Do not mark node READY when health check reports zero cpu or memory (#16511)

Instances reporting cpu=0 or memory=0 with no errors would be
transitioned to READY state. Treat zero cpu/memory as an error
so the node stays offline until a valid health check is received.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Seth Foster
2026-06-22 10:23:52 -04:00
committed by GitHub
parent 67048a609a
commit f25e436bef

View File

@@ -374,6 +374,11 @@ class Instance(HasPolicyEditsMixin, BaseModel):
self.memory = new_memory
update_fields.append('memory')
# Do not mark nodes READY if cpu or memory is zero
if not errors and self.node_type != Instance.Types.HOP and (not new_cpu or not new_memory):
errors = _('Health check for {} reported invalid values: cpu={}, memory={}').format(self.hostname, new_cpu, new_memory)
logger.warning(errors)
if not errors:
self.refresh_capacity_fields()
self.errors = ''