Alon Bar-Lev has uploaded a new change for review.

Change subject: bll: do not allow host activation with no unique id
......................................................................

bll: do not allow host activation with no unique id

partial installation of host for various of reasons will leave a host
with no uuid.

these hosts should not be allowed to be activated.

for developers, if the InstallVds option is false, this validation will
be disabled.

Change-Id: I9a15416ae21c2371ebfb12cecb1551b73c98d88f
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ActivateVdsCommand.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
6 files changed, 16 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/23/16523/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ActivateVdsCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ActivateVdsCommand.java
index 48a6734..d6af028 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ActivateVdsCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ActivateVdsCommand.java
@@ -4,6 +4,8 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.lang.StringUtils;
+
 import org.ovirt.engine.core.bll.job.ExecutionHandler;
 import org.ovirt.engine.core.bll.network.cluster.NetworkClusterHelper;
 import org.ovirt.engine.core.common.AuditLogType;
@@ -12,6 +14,8 @@
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
 import org.ovirt.engine.core.common.businessentities.network.Network;
+import org.ovirt.engine.core.common.config.Config;
+import org.ovirt.engine.core.common.config.ConfigValues;
 import org.ovirt.engine.core.common.errors.VdcBllMessages;
 import org.ovirt.engine.core.common.locks.LockingGroup;
 import org.ovirt.engine.core.common.utils.Pair;
@@ -78,6 +82,11 @@
         if (getVds() == null) {
             return 
failCanDoAction(VdcBllMessages.VDS_CANNOT_ACTIVATE_VDS_NOT_EXIST);
         }
+
+        if (StringUtils.isBlank(getVds().getUniqueId()) && Config.<Boolean> 
GetValue(ConfigValues.InstallVds)) {
+            return 
failCanDoAction(VdcBllMessages.VDS_CANNOT_ACTIVATE_VDS_NO_UUID);
+        }
+
         if (getVds().getStatus() == VDSStatus.Up) {
             return 
failCanDoAction(VdcBllMessages.VDS_CANNOT_ACTIVATE_VDS_ALREADY_UP);
         }
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 264f4f1..0c056f9 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
@@ -213,6 +213,7 @@
     VDS_CANNOT_MAINTENANCE_SPM_CONTENDING(ErrorType.CONFLICT),
     VDS_CANNOT_MAINTENANCE_VDS_IS_IN_MAINTENANCE(ErrorType.CONFLICT),
     VDS_CANNOT_ACTIVATE_VDS_ALREADY_UP(ErrorType.CONFLICT),
+    VDS_CANNOT_ACTIVATE_VDS_NO_UUID(ErrorType.CONFLICT),
     VDS_CANNOT_ACTIVATE_VDS_NOT_EXIST(ErrorType.BAD_PARAMETERS),
     VDS_STATUS_NOT_VALID_FOR_STOP(ErrorType.CONFLICT),
     VDS_STATUS_NOT_VALID_FOR_START(ErrorType.CONFLICT),
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 cf500c1..36501f5 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -89,6 +89,7 @@
 VDS_STATUS_NOT_VALID_FOR_UPDATE=Cannot ${action} ${type}. Host parameters 
cannot be modified while Host is operational.\n\
        Please switch Host to Maintenance mode first.
 VDS_CANNOT_ACTIVATE_VDS_ALREADY_UP=Cannot ${action} ${type}. Host in Up status.
+VDS_CANNOT_ACTIVATE_VDS_NO_UUID=Cannot ${action} ${type}. Host has no unique 
id.
 VDS_CANNOT_ACTIVATE_VDS_NOT_EXIST=Cannot ${action} ${type}. Host does not 
exist.
 VDS_INVALID_SERVER_ID=Cannot ${action} ${type}. Invalid Host Id.
 VDS_EMPTY_NAME_OR_ID=Cannot ${action} ${type}. Empty host name or id.
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 c694aef..9797d39 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
@@ -208,6 +208,9 @@
     @DefaultStringValue("Cannot ${action} ${type}. Host in Up status.")
     String VDS_CANNOT_ACTIVATE_VDS_ALREADY_UP();
 
+    @DefaultStringValue("Cannot ${action} ${type}. Host has no unique id.")
+    String VDS_CANNOT_ACTIVATE_VDS_NO_UUID();
+
     @DefaultStringValue("Cannot ${action} ${type}. Host does not exist.")
     String VDS_CANNOT_ACTIVATE_VDS_NOT_EXIST();
 
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 853bd17..f231284 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
@@ -89,6 +89,7 @@
 VDS_STATUS_NOT_VALID_FOR_UPDATE=Cannot ${action} ${type}. Host parameters 
cannot be modified while Host is operational.\n\
        Please switch Host to Maintenance mode first.
 VDS_CANNOT_ACTIVATE_VDS_ALREADY_UP=Cannot ${action} ${type}. Host in Up status.
+VDS_CANNOT_ACTIVATE_VDS_NO_UUID=Cannot ${action} ${type}. Host has no unique 
id.
 VDS_CANNOT_ACTIVATE_VDS_NOT_EXIST=Cannot ${action} ${type}. Host does not 
exist.
 VDS_INVALID_SERVER_ID=Cannot ${action} ${type}. Invalid Host Id.
 VDS_EMPTY_NAME_OR_ID=Cannot ${action} ${type}. Empty host name or id.
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 37effc6..ef9a3f5 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
@@ -88,6 +88,7 @@
 VDS_STATUS_NOT_VALID_FOR_UPDATE=Cannot ${action} ${type}. Host parameters 
cannot be modified while Host is operational.\n\
        Please switch Host to Maintenance mode first.
 VDS_CANNOT_ACTIVATE_VDS_ALREADY_UP=Cannot ${action} ${type}. Host in Up status.
+VDS_CANNOT_ACTIVATE_VDS_NO_UUID=Cannot ${action} ${type}. Host has no unique 
id.
 VDS_CANNOT_ACTIVATE_VDS_NOT_EXIST=Cannot ${action} ${type}. Host does not 
exist.
 VDS_INVALID_SERVER_ID=Cannot ${action} ${type}. Invalid Host Id.
 VDS_EMPTY_NAME_OR_ID=Cannot ${action} ${type}. Empty host name or id.


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

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

Reply via email to