DaanHoogland commented on code in PR #9150:
URL: https://github.com/apache/cloudstack/pull/9150#discussion_r1623928226


##########
server/src/main/java/com/cloud/api/query/dao/SnapshotJoinDaoImpl.java:
##########
@@ -124,6 +129,16 @@ public SnapshotResponse 
newSnapshotResponse(ResponseObject.ResponseView view, bo
             snapshotResponse.setVolumeName(snapshot.getVolumeName());
             snapshotResponse.setVolumeType(snapshot.getVolumeType().name());
             snapshotResponse.setVirtualSize(snapshot.getVolumeSize());
+            VolumeVO volume = 
ApiDBUtils.findVolumeById(snapshot.getVolumeId());
+            if (volume != null && volume.getVolumeType() == Type.ROOT && 
volume.getInstanceId() != null) {
+                VMInstanceVO vm = 
ApiDBUtils.findVMInstanceById(volume.getInstanceId());
+                if (vm != null) {
+                    GuestOS guestOS = 
ApiDBUtils.findGuestOSById(vm.getGuestOSId());
+                    if (guestOS != null) {
+                        snapshotResponse.setOsTypeId(guestOS.getUuid());
+                    }
+                }
+            }

Review Comment:
   @slavkap , you are adding a value from the volume (which is already in the 
join dao) , does it make sense to let the view do this work? (i.e. add guestos 
to the join)



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