fermosan commented on code in PR #6550:
URL: https://github.com/apache/cloudstack/pull/6550#discussion_r967639242


##########
server/src/main/java/com/cloud/hypervisor/KVMGuru.java:
##########
@@ -68,6 +83,37 @@ protected KVMGuru() {
         super();
     }
 
+    /**
+     * Get next free DeviceId for a KVM Guest
+     */
+
+    protected Long getNextAvailableDeviceId(List<VolumeVO> vmVolumes) {
+
+        int maxDataVolumesSupported;
+        int maxDeviceId;
+        List<String> devIds = new ArrayList<>();
+
+        try {
+            maxDataVolumesSupported = 
_hypervisorCapabilitiesDao.getMaxDataVolumesLimit(HypervisorType.KVM,"default");
+            int maxDevices = maxDataVolumesSupported + 2; // add 2 to consider 
devices root volume and cdrom

Review Comment:
   This is actually how 
/main/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java@4070  
handles the deviceid discovery. The +2 is KVM specific for anticipating root 
volume and removable cdrom devices as far as i understand. 



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