Federico Simoncelli has uploaded a new change for review.

Change subject: core: block MoveDisks on snapshot preview
......................................................................

core: block MoveDisks on snapshot preview

The moveImage command in VDSM (at the moment of this writing) cannot
move disks of VMs that are in preview mode. An additional validation
has been added to MoveDisksCommand to prevent such action for the time
being.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=865021
Change-Id: Ib3b93d08eaadb230fe2cc985a9ba57efb5dd3abb
Signed-off-by: Federico Simoncelli <fsimo...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveDisksCommand.java
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/40/11340/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveDisksCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveDisksCommand.java
index 7e347b3..3a7562d 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveDisksCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveDisksCommand.java
@@ -5,6 +5,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.ovirt.engine.core.bll.snapshots.SnapshotsValidator;
 import org.ovirt.engine.core.bll.utils.PermissionSubject;
 import org.ovirt.engine.core.common.VdcObjectType;
 import org.ovirt.engine.core.common.action.LiveMigrateDiskParameters;
@@ -94,8 +95,12 @@
 
             List<VM> allVms = getVmDAO().getVmsListForDisk(diskImage.getId());
             VM vm = !allVms.isEmpty() ? allVms.get(0) : null;
+            SnapshotsValidator snapshotsValidator = new SnapshotsValidator();
 
-            if (vm == null || isVmDown(vm)) {
+            if (vm != null && 
!validate(snapshotsValidator.vmNotInPreview(vm.getId()))) {
+                return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IN_PREVIEW);
+            }
+            else if (vm == null || isVmDown(vm)) {
                 moveParametersList.add(moveDiskParameters);
             }
             else if (isVmRunning(vm)) {


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3b93d08eaadb230fe2cc985a9ba57efb5dd3abb
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to