Repository navigation
Conversation
| elif not socket_path: | ||
| logging.error("Cannot send alert: socket_path is required but was not provided") | ||
| else: | ||
| if send_nic_down_alert(socket_path): |
There was a problem hiding this comment.
A delayed nic-down acknowledgement can suppress recovery permanently. Lines 210–214 set alert_sent only when the acknowledgement arrives. The receiver replies after stopping nova-compute and handling VMs. If that takes over three seconds, the sender times out despite the action occurring. If connectivity recovers before another successful nic-down exchange, alert_sent remains false and no nic-up is sent.
There was a problem hiding this comment.
on_failure now sets alert_sent = True optimistically regardless of the ack (src/tcp_health_check.py:213-215). A timed-out ack logs a warning but the recovery nic-up is still armed.
Safe because the receiver is idempotent: it saves state before acting on nic-down, and nic-up is a no-op if no evacuation was recorded. Nic-up still requires N consecutive successes, so flapping behavior is unchanged.
gboutry
left a comment
There was a problem hiding this comment.
I reran the delayed-ack case against the receiver over a local Unix socket, with the Nova and Masakari calls stubbed. nic-up is now sent when the socket timeout returns before the check is killed. I hit two other cases that still need fixing.
Issue
The health check (
tcp_health_check.py) sendsnic-downto the hypervisor'spre-evacuation-setup-servicewhen it cannot reach the Consul servers. It never reports that the connection came back, so the hypervisor has no signal to recover and nova-compute stays stopped. (LP #2171374)Solution
The detector now sends
nic-uponce connectivity returns:nic-upis sent after anic-downwas sent and the check has succeededmonitoring_samplestimes in a row, so a flapping link doesn't trigger repeated recoveries.failure_count,alert_sentandsuccess_count. It is written atomically and only when the state changes.The receiving side is in snap-openstack-hypervisor: hypervisor PR. Restarting VMs and the false
nic-downtrigger are out of scope.Context
Consul runs the check script about every 12s and kills it at a 5s timeout. The script talks to the hypervisor snap over a unix socket (
consul-socketplug) with JSON messages, protocol version 1.0, statusesnic-downandnic-up.During testing the
consul-socketplug was connected only once, and aFielddefault in consul-notify misbehaved. I connected the plug by hand on the nodes. Neither is changed here.Testing Instructions
tox -e unit-tests(72 tests) andtox -e lint.src/tcp_health_check.pyto/var/snap/consul-client_<id>/common/consul/data/on a compute node. The hypervisor snap must carry the matching receiver change.10.1.0.0/16, port 30321), not the service IP. Expectnic-downand nova-compute stopped.monitoring_samplesconsecutive successes, expectnic-upand nova-compute active again.nic-upuntil the successes are consecutive.