Repository navigation
Conversation
When recreate_vm deletes a VM, LocalDnsRecord entries for that instance were not removed before the new VM is created. If recreation failed partway through, other VMs were left with a DNS record pointing to a dead IP indefinitely. Call delete_dns_for_instance immediately after delete_vm_from_cloud, consistent with how InstanceDeleter handles permanent instance deletion. DNS cleanup failure is treated as non-fatal since the VM is already gone and recreation must proceed regardless. This was an oversight from when LocalDnsManager was introduced — InstanceDeleter and the errand manager were updated at the time, but CloudcheckHelper was not.
|
No actionable comments were generated in the recent review. WalkthroughVM recreation and unresponsive-agent resolution now attempt to delete an instance’s DNS records after deleting its VM. The shared helper logs a warning and continues if DNS cleanup raises a Suggested reviewers: Merge Risk:
|
There was a problem hiding this comment.
🟡 Changes recommended
Lifecycle specs leave the stale-DNS regression unprotected because they do not verify cleanup, broadcast, or non-fatal cleanup errors during VM recreation and standalone deletion.
1 open issue
What changed in this PR
This PR updates the Director’s VM recovery paths to remove stale DNS records after deleting a VM, preventing dead-IP lookups if recreation fails.
Changes:
- Remove instance DNS records and broadcast the updated blob before recreating a VM.
- Apply the same cleanup to the unresponsive-agent
delete_vmresolution. - Log DNS cleanup failures without aborting the operation.
| File | Description |
|---|---|
src/bosh-director/lib/bosh/director/problem_handlers/unresponsive_agent.rb |
Adds DNS cleanup after the delete_vm resolution deletes the VM. |
src/bosh-director/lib/bosh/director/cloudcheck_helper.rb |
Adds a non-fatal DNS cleanup helper and invokes it during VM recreation. |
Review effort: Balanced
a-hassanin
left a comment
There was a problem hiding this comment.
Makes sense! Thank you

What is this change about?
When
CloudcheckHelper#recreate_vmdeletes a VM (viadelete_vm_from_cloud), theLocalDnsRecordentries for that instance are not removed before the new VM is created. If recreation fails partway through, other VMs are left with a DNS record pointing to a dead IP indefinitely - the background DNS converger only re-sends the current blob, it does not fix stale records.This change introduces a
delete_dns_for_instance_safelyprivate helper that removes the instance's DNS records and broadcasts the updated blob to all remaining VMs immediately after the old VM is deleted. It is called from bothrecreate_vmand thedelete_vmresolution inUnresponsiveAgent, which had the same gap.DNS cleanup failure is treated as non-fatal: at this point the VM is already gone and the operation must proceed regardless. A stale record in that case will be corrected by the next successful deploy or resurrection.
Please provide contextual information.
No prior issue or discussion. Discovered while investigating how
sync_dnsbehaves during the resurrector lifecycle.How should this change be described in bosh release notes?
Fixed: DNS records for a VM being resurrected are now removed immediately when the old VM is deleted, preventing other VMs from resolving a stale IP if recreation fails.
Does this PR introduce a breaking change?
No. During VM recreation there is now a short window where the instance is unresolvable (NXDOMAIN) rather than resolving to a dead IP.