From b906ff626ce35a44254f528888425638fb96241b Mon Sep 17 00:00:00 2001 From: "L. Pivarc" Date: Wed, 22 Feb 2023 17:28:43 +0100 Subject: [PATCH] Allow paused VM to migrate This is currently possible only through VMIM API. Signed-off-by: L. Pivarc --- pkg/virt-api/rest/subresource.go | 9 +-------- tests/pausing_test.go | 13 ------------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/pkg/virt-api/rest/subresource.go b/pkg/virt-api/rest/subresource.go index dd566829e378..e4c91ec146cd 100644 --- a/pkg/virt-api/rest/subresource.go +++ b/pkg/virt-api/rest/subresource.go @@ -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 @@ -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{ diff --git a/tests/pausing_test.go b/tests/pausing_test.go index 10f9ec3ee287..97a66529d677 100644 --- a/tests/pausing_test.go +++ b/tests/pausing_test.go @@ -356,19 +356,6 @@ var _ = Describe("[rfe_id:3064][crit:medium][vendor:cnv-qe@redhat.com][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)