Roy Golan has uploaded a new change for review.

Change subject: core: avoid removing a vm also when migratingTo
......................................................................

core: avoid removing a vm also when migratingTo

The fix simplifies the check and states what states we CAN delete the VM
, otherwise fail canDoAction

Change-Id: I6d97fbe84a81a3a4704ed1d80d9b52da752c108a
Bug-Url: https://bugzilla.redhat.com/947965
Signed-off-by: Roy Golan <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java
1 file changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/69/31369/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java
index d373a2c..5f34139 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java
@@ -3,6 +3,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.EnumSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -171,7 +172,13 @@
             return false;
         }
 
-        if (getVm().isRunningOrPaused() || getVm().getStatus() == 
VMStatus.Unknown || getVm().getStatus() == VMStatus.NotResponding) {
+        if (!EnumSet.of(
+                VMStatus.Unassigned,
+                VMStatus.Down,
+                VMStatus.Suspended,
+                VMStatus.ImageIllegal,
+                VMStatus.ImageLocked
+        ).contains(getVm().getStatus())) {
             return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_RUNNING);
         }
         if (getVm().getStatus() == VMStatus.Suspended) {


-- 
To view, visit http://gerrit.ovirt.org/31369
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6d97fbe84a81a3a4704ed1d80d9b52da752c108a
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Roy Golan <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to