Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ func (h *AttachedHandler) getAttachedVirtualMachine(ctx context.Context, vmip *v
}

if attachedVM != nil {
// A VM that is being deleted is not considered attached so the VMIP can be released and, if managed, removed (e.g. during cascade deletion).
if !attachedVM.GetDeletionTimestamp().IsZero() && len(attachedVM.Status.VirtualMachinePods) == 0 {
return nil, nil
}
if network.HasMainNetworkStatus(attachedVM.Status.Networks) {
return attachedVM, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ func (w VirtualMachineWatcher) Watch(mgr manager.Manager, ctr controller.Control
return true
}

if len(oldVM.Status.VirtualMachinePods) != len(newVM.Status.VirtualMachinePods) {
return true
}

return false
},
},
Expand Down
Loading