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


##########
server/src/main/java/com/cloud/resource/ResourceManagerImpl.java:
##########
@@ -1002,7 +1019,7 @@ public void doInTransactionWithoutResult(final 
TransactionStatus status) {
                         storagePool.setClusterId(null);
                         _storagePoolDao.update(poolId, storagePool);
                         _storagePoolDao.remove(poolId);
-                        logger.debug("Local storage [id: {}] is removed as a 
part of {} removal", storagePool, hostRemoved);
+                        logger.debug("Local storage [id: {}] is removed as a 
part of host [{}] removal", poolId, hostRemoved.toString());

Review Comment:
   ```suggestion
                           logger.debug("Local storage [ID: {}] is removed as a 
part of host [{}] removal", poolId, hostRemoved.toString());
   ```



##########
server/src/main/java/com/cloud/resource/ResourceManagerImpl.java:
##########
@@ -909,31 +909,41 @@ protected boolean doDeleteHost(final long hostId, final 
boolean isForced, final
         // Verify that host exists
         final HostVO host = _hostDao.findById(hostId);
         if (host == null) {
-            throw new InvalidParameterValueException("Host with id " + hostId 
+ " doesn't exist");
+            String errorMessage = String.format("Host with ID [%s] was not 
found", hostId);
+            logger.warn(errorMessage);
+            throw new InvalidParameterValueException(errorMessage);
         }
+        logger.info("Attempting to delete host with UUID [{}].", 
host.getUuid());
+
         
_accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(),
 host.getDataCenterId());
 
         if (!canDeleteHost(host) && !isForced) {
-            throw new CloudRuntimeException("Host " + host.getUuid() +
-                    " cannot be deleted as it is not in maintenance mode. 
Either put the host into maintenance or perform a forced deletion.");
+            String errorMessage = String.format("Host with UUID [%s] is not in 
maintenance mode and no forced deletion was requested.", host.getUuid());
+            logger.warn(errorMessage);
+            throw new CloudRuntimeException(errorMessage);
         }
         // Get storage pool host mappings here because they can be removed as a
         // part of handleDisconnect later
         final List<StoragePoolHostVO> pools = 
_storagePoolHostDao.listByHostIdIncludingRemoved(hostId);
 
+        logger.debug("Getting storage pools including those removed by host 
with UUID [{}]: [{}].", host.getUuid(), pools);
+
         final ResourceStateAdapter.DeleteHostAnswer answer =
                 
(ResourceStateAdapter.DeleteHostAnswer)dispatchToStateAdapters(ResourceStateAdapter.Event.DELETE_HOST,
 false, host, isForced,
                         isForceDeleteStorage);
 
         if (answer == null) {
-            throw new CloudRuntimeException(String.format("No resource adapter 
respond to DELETE_HOST event for %s, hypervisorType is %s, host type is %s",
-                    host, host.getHypervisorType(), host.getType()));
+            String errorMessage = String.format("No resource adapter answer 
was returned to DELETE_HOST event for host [%s] with ID [%s], hypervisor type 
[%s] and host type [%s]. ",

Review Comment:
   ```suggestion
               String errorMessage = String.format("No resource adapter answer 
was returned to DELETE_HOST event for host [%s] with ID [%s], hypervisor type 
[%s] and host type [%s].",
   ```



-- 
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