From a772da805a5b756ab2c6fbcf4fa105a204ec8761 Mon Sep 17 00:00:00 2001 From: fossedihelm Date: Wed, 6 Nov 2024 09:29:00 +0100 Subject: [PATCH] Trigger final cleanup when the migration fails Also increase verbosity and focus for test purposes Signed-off-by: fossedihelm --- pkg/virt-handler/vm.go | 2 ++ tests/migration/migration.go | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/pkg/virt-handler/vm.go b/pkg/virt-handler/vm.go index 0a75d6f2ff0c..202c13937780 100644 --- a/pkg/virt-handler/vm.go +++ b/pkg/virt-handler/vm.go @@ -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, diff --git a/tests/migration/migration.go b/tests/migration/migration.go index 0ae4749a5891..808022cc0c94 100644 --- a/tests/migration/migration.go +++ b/tests/migration/migration.go @@ -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") @@ -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() {