RosiKyu commented on code in PR #13444:
URL: https://github.com/apache/cloudstack/pull/13444#discussion_r3459588635


##########
server/src/main/java/com/cloud/api/query/dao/HostJoinDaoImpl.java:
##########
@@ -117,6 +117,51 @@ private boolean containsHostHATag(final String tags) {
         return result;
     }
 
+    private void setNewCoreHostResponse(HostJoinVO host, HostResponse 
hostResponse) {
+        hostResponse.setId(host.getUuid());
+        hostResponse.setName(host.getName());
+        hostResponse.setState(host.getStatus());
+        hostResponse.setResourceState(host.getResourceState().toString());
+        hostResponse.setDisconnectedOn(host.getDisconnectedOn());
+        hostResponse.setHostType(host.getType());
+        hostResponse.setIpAddress(host.getPrivateIpAddress());
+        hostResponse.setVersion(host.getVersion());
+        hostResponse.setCreated(host.getCreated());
+        hostResponse.setRemoved(host.getRemoved());
+        hostResponse.setLastPinged(new Date(host.getLastPinged()));
+        if (host.getHypervisorType() != null) {
+            
hostResponse.setHypervisor(host.getHypervisorType().getHypervisorDisplayName());
+        }
+
+        hostResponse.setZoneId(host.getZoneUuid());
+        hostResponse.setZoneName(host.getZoneName());
+        hostResponse.setPodId(host.getPodUuid());
+        hostResponse.setPodName(host.getPodName());
+        if (host.getClusterId() > 0) {
+            hostResponse.setClusterId(host.getClusterUuid());
+            hostResponse.setClusterName(host.getClusterName());
+            if (host.getClusterType() != null) {
+                hostResponse.setClusterType(host.getClusterType().toString());
+            }
+        }
+
+        String hostTags = host.getTag();
+        hostResponse.setHostTags(hostTags);
+        hostResponse.setExplicitHostTags(host.getExplicitTag());
+        hostResponse.setImplicitHostTags(host.getImplicitTag());
+        hostResponse.setStorageAccessGroups(host.getStorageAccessGroups());
+        
hostResponse.setClusterStorageAccessGroups(host.getClusterStorageAccessGroups());
+        
hostResponse.setPodStorageAccessGroups(host.getPodStorageAccessGroups());
+        
hostResponse.setZoneStorageAccessGroups(host.getZoneStorageAccessGroups());
+
+        // msid is returned as-is; callers resolve it to avoid a per-host 
lookup
+        if (host.getManagementServerId() != null) {
+            
hostResponse.setManagementServerId(host.getManagementServerId().toString());
+        }

Review Comment:
   Reproduced while testing. In `core` the `managementserverid` comes back as 
the raw numeric id, while every other mode returns the UUID - so the same field 
changes format depending on the detail flag, which could be a risk for 
consumers reading it. From a QA perspective, omitting it (as suggested above) 
is the safer of the two - a missing field is easier to handle than a value that 
looks valid but is in the wrong/unexpected format. 



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