bernardodemarco commented on code in PR #10325:
URL: https://github.com/apache/cloudstack/pull/10325#discussion_r1951742648


##########
server/src/main/java/com/cloud/server/ManagementServerImpl.java:
##########
@@ -5493,4 +5500,24 @@ public void setLockControllerListener(final 
LockControllerListener lockControlle
         _lockControllerListener = lockControllerListener;
     }
 
+    @Override
+    @DB
+    @ActionEvent(eventType = EventTypes.EVENT_MANAGEMENT_SERVER_REMOVE, 
eventDescription = "removing Management Server")
+    public boolean removeManagementServer(RemoveManagementServerCmd cmd) {
+        final Long id = cmd.getId();
+        ManagementServerJoinVO managementServer = 
managementServerJoinDao.findById(id);
+
+        if (managementServer == null) {
+            throw new InvalidParameterValueException(String.format("Unable to 
find a Management Server with ID equal to [%s]", managementServer.getUuid()));
+        }
+
+        if 
(!ManagementServerHost.State.Down.equals(managementServer.getState())) {
+            throw new InvalidParameterValueException(String.format("Unable to 
remove Management Server with ID [%s]. It can only be removed when it is in the 
[%s] state, however currently it is in the [%s] state", 
managementServer.getUuid(), ManagementServerHost.State.Down.name(), 
ManagementServerHost.State.Up.name()));
+        }

Review Comment:
   ```suggestion
           if 
(!ManagementServerHost.State.Down.equals(managementServer.getState())) {
               throw new InvalidParameterValueException(String.format("Unable 
to remove Management Server with ID [%s]. It can only be removed when it is in 
the [%s] state, however currently it is in the [%s] state", 
managementServer.getUuid(), ManagementServerHost.State.Down.name(), 
managementServer.getState().name()));
           }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to