Sergey Gotliv has uploaded a new change for review.

Change subject: engine: Improve iSCSI Bond CDA validation
......................................................................

engine: Improve iSCSI Bond CDA validation

Returns appropriate error message when trying to manage iSCSI Bonds via
rest api for datacenter version < 3.4

Change-Id: I1d0ac7e6af6cb87b500740d679af2f13e63dbeb5
Signed-off-by: Sergey Gotliv <sgot...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddIscsiBondCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/BaseIscsiBondCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/EditIscsiBondCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveIscsiBondCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
M 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
M 
frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
9 files changed, 30 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/31/26931/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddIscsiBondCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddIscsiBondCommand.java
index 8912504..afe069a 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddIscsiBondCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddIscsiBondCommand.java
@@ -26,6 +26,10 @@
 
     @Override
     protected boolean canDoAction() {
+        if (!super.canDoAction()) {
+            return false;
+        }
+
         IscsiBondValidator validator = new IscsiBondValidator();
         return 
validate(validator.iscsiBondWithTheSameNameExistInDataCenter(getIscsiBond()));
     }
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/BaseIscsiBondCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/BaseIscsiBondCommand.java
index d058a90..398d801 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/BaseIscsiBondCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/BaseIscsiBondCommand.java
@@ -7,6 +7,7 @@
 
 import org.ovirt.engine.core.bll.CommandBase;
 import org.ovirt.engine.core.bll.utils.PermissionSubject;
+import org.ovirt.engine.core.common.FeatureSupported;
 import org.ovirt.engine.core.common.VdcObjectType;
 import org.ovirt.engine.core.common.action.VdcActionParametersBase;
 import org.ovirt.engine.core.common.businessentities.IscsiBond;
@@ -14,6 +15,7 @@
 import org.ovirt.engine.core.common.businessentities.StorageType;
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
+import org.ovirt.engine.core.common.errors.VdcBllMessages;
 import 
org.ovirt.engine.core.common.vdscommands.StorageServerConnectionManagementVDSParameters;
 import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
 import org.ovirt.engine.core.compat.Guid;
@@ -30,6 +32,15 @@
     }
 
     @Override
+    protected boolean canDoAction() {
+        if 
(!FeatureSupported.isIscsiMultipathingSupported(getStoragePool().getcompatibility_version()))
 {
+            return failCanDoAction(VdcBllMessages.ISCSI_BOND_NOT_SUPPORTED);
+        }
+
+        return true;
+    }
+
+    @Override
     public List<PermissionSubject> getPermissionCheckSubjects() {
         return Collections.singletonList(new 
PermissionSubject(getStoragePoolId(),
                 VdcObjectType.StoragePool, getActionType().getActionGroup()));
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/EditIscsiBondCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/EditIscsiBondCommand.java
index e1e65cb..271d499 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/EditIscsiBondCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/EditIscsiBondCommand.java
@@ -35,6 +35,10 @@
 
     @Override
     protected boolean canDoAction() {
+        if (!super.canDoAction()) {
+            return false;
+        }
+
         IscsiBondValidator validator = new IscsiBondValidator();
 
         if (!validate(validator.isIscsiBondExist(getExistingIscsiBond()))) {
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveIscsiBondCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveIscsiBondCommand.java
index 5ffa6aa..34bec12 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveIscsiBondCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveIscsiBondCommand.java
@@ -17,6 +17,10 @@
 
     @Override
     protected boolean canDoAction() {
+        if (!super.canDoAction()) {
+            return false;
+        }
+
         IscsiBondValidator validator = new IscsiBondValidator();
         return validate(validator.isIscsiBondExist(getIscsiBond()));
     }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
index 318e622..59618fb 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
@@ -961,6 +961,7 @@
 
     // Iscsi bonds
     ISCSI_BOND_WITH_SAME_NAME_EXIST_IN_DATA_CENTER(ErrorType.CONFLICT),
+    ISCSI_BOND_NOT_SUPPORTED(ErrorType.NOT_SUPPORTED),
     ISCSI_BOND_NOT_EXIST(ErrorType.BAD_PARAMETERS);
 
     private ErrorType messageType;
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
index aaae9a1..ecc2ce6 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -1172,5 +1172,6 @@
 
 ISCSI_BOND_NOT_EXIST=Cannot ${action} ${type}. The specified iSCSI bond 
doesn't exist.
 ISCSI_BOND_WITH_SAME_NAME_EXIST_IN_DATA_CENTER=Cannot ${action} ${type}. iSCSI 
bond with the same name already exists in the Data Center.
+ISCSI_BOND_NOT_SUPPORTED=Cannot ${action} ${type}. iSCSI Bond is only 
supported on Data Center compatibility version 3.4 and higher.
 
 ACTION_TYPE_FAILED_IDE_INTERFACE_DOES_NOT_SUPPORT_READ_ONLY_ATTR=Cannot 
${action} ${type}. An IDE disk can't be read-only.
diff --git 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
index f4185b4..807799e 100644
--- 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
+++ 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
@@ -3133,6 +3133,9 @@
     @DefaultStringValue("Cannot ${action} ${type}. The specified iSCSI bond 
doesn't exist.")
     String ISCSI_BOND_NOT_EXIST();
 
+    @DefaultStringValue("Cannot ${action} ${type}. iSCSI Bond is only 
supported on Data Center compatibility version 3.4 and higher.")
+    String ISCSI_BOND_NOT_SUPPORTED();
+
     @DefaultStringValue("Cannot ${action} ${type}. An IDE disk can't be 
read-only.")
     String ACTION_TYPE_FAILED_IDE_INTERFACE_DOES_NOT_SUPPORT_READ_ONLY_ATTR();
 
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index 35235e2..3c66aa5 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -1003,5 +1003,6 @@
 
 ISCSI_BOND_NOT_EXIST=Cannot ${action} ${type}. The specified iSCSI bond 
doesn't exist.
 ISCSI_BOND_WITH_SAME_NAME_EXIST_IN_DATA_CENTER=Cannot ${action} ${type}. iSCSI 
bond with the same name already exists in the Data Center.
+ISCSI_BOND_NOT_SUPPORTED=Cannot ${action} ${type}. iSCSI Bond is only 
supported on Data Center compatibility version 3.4 and higher.
 
 ACTION_TYPE_FAILED_IDE_INTERFACE_DOES_NOT_SUPPORT_READ_ONLY_ATTR=Cannot 
${action} ${type}. An IDE disk can't be read-only.
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index ca639c7..a28e5c8 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++ 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -1143,5 +1143,6 @@
 
 ISCSI_BOND_NOT_EXIST=Cannot ${action} ${type}. The specified iSCSI bond 
doesn't exist.
 ISCSI_BOND_WITH_SAME_NAME_EXIST_IN_DATA_CENTER=Cannot ${action} ${type}. iSCSI 
bond with the same name already exists in the Data Center.
+ISCSI_BOND_NOT_SUPPORTED=Cannot ${action} ${type}. iSCSI Bond is only 
supported on Data Center compatibility version 3.4 and higher.
 
 ACTION_TYPE_FAILED_IDE_INTERFACE_DOES_NOT_SUPPORT_READ_ONLY_ATTR=Cannot 
${action} ${type}. An IDE disk can't be read-only.


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

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

Reply via email to