You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "slavkap (via GitHub)" <gi...@apache.org> on 2024/05/30 14:06:45 UTC

[PR] Added ostypeid in the snapshot response [cloudstack]

slavkap opened a new pull request, #9150:
URL: https://github.com/apache/cloudstack/pull/9150

   This PR adds the OS type UUID in the list snapshot/snapshots response
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [X] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   - [ ] build/CI
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [X] Minor
   
   


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Added ostypeid in the snapshot response [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org