From 52a5f054615fb6dbd72a54b970bb61e85a622d46 Mon Sep 17 00:00:00 2001 From: David Vossel Date: Tue, 17 Oct 2017 16:30:50 -0400 Subject: [PATCH 1/2] Cleanup virt-launcher pods for finalized VMs Signed-off-by: David Vossel --- pkg/virt-controller/watch/vm.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/virt-controller/watch/vm.go b/pkg/virt-controller/watch/vm.go index 5bf8876f8f31..89d700350522 100644 --- a/pkg/virt-controller/watch/vm.go +++ b/pkg/virt-controller/watch/vm.go @@ -245,6 +245,13 @@ func (c *VMController) execute(key string) error { return 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 nil } From 2f7fde4a9a998c3e9ae17640e08767605199af8e Mon Sep 17 00:00:00 2001 From: David Vossel Date: Tue, 17 Oct 2017 16:47:22 -0400 Subject: [PATCH 2/2] Increase virt-launcher timeout to 5 minutes Signed-off-by: David Vossel --- pkg/virt-controller/services/template.go | 2 +- pkg/virt-controller/services/template_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/virt-controller/services/template.go b/pkg/virt-controller/services/template.go index c38758ce39da..9d0d4d8c6972 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 8a77b6d9ec12..9a8ffee08f23 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",