Federico Simoncelli has uploaded a new change for review.

Change subject: backend: check image status before ExportRepoImage
......................................................................

backend: check image status before ExportRepoImage

Before running the ExportRepoImage command we should also check if the
image is locked or illegal and in such case prevent the export.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1024883
Change-Id: Ib0957a05db4a0fdcddf56a63b0a3da0b4d27db6d
Signed-off-by: Federico Simoncelli <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ExportRepoImageCommand.java
1 file changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/71/20871/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ExportRepoImageCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ExportRepoImageCommand.java
index 5f36cd0..329f7c6 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ExportRepoImageCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ExportRepoImageCommand.java
@@ -3,6 +3,7 @@
 import org.ovirt.engine.core.bll.provider.OpenStackImageProviderProxy;
 import org.ovirt.engine.core.bll.provider.ProviderProxyFactory;
 import org.ovirt.engine.core.bll.utils.PermissionSubject;
+import org.ovirt.engine.core.bll.validator.DiskImagesValidator;
 import org.ovirt.engine.core.bll.validator.StorageDomainValidator;
 import org.ovirt.engine.core.common.AuditLogType;
 import org.ovirt.engine.core.common.VdcObjectType;
@@ -27,6 +28,7 @@
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.core.dao.DiskDao;
 
+import java.util.Arrays;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -234,6 +236,12 @@
             }
         }
 
+        DiskImagesValidator diskImagesValidator = new 
DiskImagesValidator(Arrays.asList(getDiskImage()));
+        if (!validate(diskImagesValidator.diskImagesNotIllegal())
+                || !validate(diskImagesValidator.diskImagesNotLocked())) {
+            return false;
+        }
+
         return true;
     }
 


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

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

Reply via email to