Skip to content

Commit

Permalink
Merge pull request kubevirt#9300 from xpivarc/paused-migration
Browse files Browse the repository at this point in the history
Bug fix: Allow paused VM to migrate
  • Loading branch information
kubevirt-bot authored Mar 3, 2023
2 parents ce8aab7 + b906ff6 commit b96fb5b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
9 changes: 1 addition & 8 deletions pkg/virt-api/rest/subresource.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func (app *SubresourceAPIApp) MigrateVMRequestHandler(request *restful.Request,
return
}
}
vm, err := app.fetchVirtualMachine(name, namespace)
_, err := app.fetchVirtualMachine(name, namespace)
if err != nil {
writeError(err, response)
return
Expand All @@ -327,13 +327,6 @@ func (app *SubresourceAPIApp) MigrateVMRequestHandler(request *restful.Request,
return
}

for _, c := range vm.Status.Conditions {
if c.Type == v1.VirtualMachinePaused && c.Status == v12.ConditionTrue {
writeError(errors.NewConflict(v1.Resource("virtualmachine"), name, fmt.Errorf("VM is paused")), response)
return
}
}

createMigrationJob := func() *errors.StatusError {
_, err := app.virtCli.VirtualMachineInstanceMigration(namespace).Create(&v1.VirtualMachineInstanceMigration{
ObjectMeta: k8smetav1.ObjectMeta{
Expand Down
13 changes: 0 additions & 13 deletions tests/pausing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,19 +357,6 @@ var _ = Describe("[rfe_id:3064][crit:medium][vendor:[email protected]][level:com

})

It("[test_id:3086]should not be migrated", func() {
By("Pausing the VM")
command := clientcmd.NewRepeatableVirtctlCommand("pause", "vm", "--namespace", vm.Namespace, vm.Name)
Expect(command()).To(Succeed())
Eventually(matcher.ThisVM(vm), 30*time.Second, time.Second).Should(matcher.HaveConditionTrue(v1.VirtualMachinePaused))

By("Trying to migrate the VM")
command = clientcmd.NewRepeatableVirtctlCommand("migrate", "--namespace", vm.Namespace, vm.Name)
err = command()
Expect(err.Error()).To(ContainSubstring("VM is paused"))

})

It("[test_id:3083]should connect to serial console", func() {
By("Pausing the VM")
command := clientcmd.NewRepeatableVirtctlCommand("pause", "vm", "--namespace", vm.Namespace, vm.Name)
Expand Down

0 comments on commit b96fb5b

Please sign in to comment.