Skip to content

Commit

Permalink
Trigger final cleanup when the migration fails
Browse files Browse the repository at this point in the history
Also increase verbosity and focus for test purposes

Signed-off-by: fossedihelm <ffossemo@redhat.com>
  • Loading branch information
fossedihelm committed Nov 8, 2024
1 parent 6e527bc commit a772da8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/virt-handler/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -2778,6 +2778,8 @@ func (d *VirtualMachineController) vmUpdateHelperMigrationTarget(origVMI *v1.Vir
}
log.Log.Object(vmi).Infof("Signaled target pod for failed migration to clean up")
// nothing left to do here if the migration failed.
// Re-enqueue to trigger final cleanup
d.Queue.AddAfter(controller.VirtualMachineInstanceKey(vmi), time.Second)
return nil
} else if migrations.IsMigrating(vmi) {
// If the migration has already started,
Expand Down
8 changes: 8 additions & 0 deletions tests/migration/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -1877,6 +1877,13 @@ var _ = SIGMigrationDescribe("VM Live Migration", func() {
})

It("old finalized migrations should get garbage collected", func() {
kvConfig := getCurrentKvConfig(virtClient)
kvConfig.DeveloperConfiguration.LogVerbosity = &v1.LogVerbosity{
VirtController: 9,
VirtHandler: 9,
VirtLauncher: 9,
}
tests.UpdateKubeVirtConfigValueAndWait(kvConfig)
vmi := tests.NewRandomFedoraVMI()
vmi.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("1Gi")

Expand Down Expand Up @@ -1914,6 +1921,7 @@ var _ = SIGMigrationDescribe("VM Live Migration", func() {
migrations, err := virtClient.VirtualMachineInstanceMigration(vmi.Namespace).List(&metav1.ListOptions{})
Expect(err).ToNot(HaveOccurred())
Expect(migrations.Items).To(HaveLen(5))
Fail("Failing on purpose")
})

It("[test_id:6979]Target pod should exit after failed migration", func() {
Expand Down

0 comments on commit a772da8

Please sign in to comment.