diff --git a/pkg/virt-controller/services/template.go b/pkg/virt-controller/services/template.go index 52082cb5175b..2f2ec0ebfc94 100644 --- a/pkg/virt-controller/services/template.go +++ b/pkg/virt-controller/services/template.go @@ -63,7 +63,7 @@ func (t *templateService) RenderLaunchManifest(vm *v1.VirtualMachine) (*kubev1.P Image: t.launcherImage, ImagePullPolicy: kubev1.PullIfNotPresent, Command: []string{"/virt-launcher", - "--qemu-timeout", "60s", + "--qemu-timeout", "5m", "--name", domain, "--namespace", namespace, "--socket-dir", t.socketBaseDir, diff --git a/pkg/virt-controller/services/template_test.go b/pkg/virt-controller/services/template_test.go index 86e9045443db..8fee25a63349 100644 --- a/pkg/virt-controller/services/template_test.go +++ b/pkg/virt-controller/services/template_test.go @@ -54,7 +54,7 @@ var _ = Describe("Template", func() { Expect(pod.ObjectMeta.GenerateName).To(Equal("virt-launcher-testvm-----")) Expect(pod.Spec.NodeSelector).To(BeEmpty()) Expect(pod.Spec.Containers[0].Command).To(Equal([]string{"/virt-launcher", - "--qemu-timeout", "60s", + "--qemu-timeout", "5m", "--name", "testvm", "--namespace", "testns", "--socket-dir", "/var/run/libvirt", @@ -83,7 +83,7 @@ var _ = Describe("Template", func() { "kubernetes.io/hostname": "master", })) Expect(pod.Spec.Containers[0].Command).To(Equal([]string{"/virt-launcher", - "--qemu-timeout", "60s", + "--qemu-timeout", "5m", "--name", "testvm", "--namespace", "default", "--socket-dir", "/var/run/libvirt", diff --git a/pkg/virt-controller/watch/vm.go b/pkg/virt-controller/watch/vm.go index 4d2a1eeca0d3..9619e8d9f1a9 100644 --- a/pkg/virt-controller/watch/vm.go +++ b/pkg/virt-controller/watch/vm.go @@ -252,6 +252,13 @@ func (c *VMController) execute(key string) (bool, error) { return false, err } logger.Info().Msgf("VM successfully scheduled to %s.", vmCopy.Status.NodeName) + case kubev1.Failed, kubev1.Succeeded: + err := c.vmService.DeleteVMPod(vm) + if err != nil { + logger.Error().Reason(err).Msg("Deleting VM target Pod failed.") + return err + } + logger.Info().Msg("Deleted VM target Pod for VM in finalized state.") } return false, nil }