Skip to content

Commit

Permalink
Merge pull request kubevirt#512 from davidvossel/virt-launcher-timeout
Browse files Browse the repository at this point in the history
virt-launcher lifecycle cleanup
  • Loading branch information
rmohr authored Oct 18, 2017
2 parents 5a76441 + 2f7fde4 commit a867633
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/virt-controller/services/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions pkg/virt-controller/services/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions pkg/virt-controller/watch/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit a867633

Please sign in to comment.