shwstppr commented on code in PR #8135:
URL: https://github.com/apache/cloudstack/pull/8135#discussion_r1415621728


##########
server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java:
##########
@@ -550,6 +552,11 @@ public UserVmResponse setUserVmResponse(ResponseView view, 
UserVmResponse userVm
             userVmData.addAffinityGroup(resp);
         }
 
+        if (StringUtils.isEmpty(userVmData.getDiskOfferingId()) && 
!Volume.Type.ROOT.equals(uvo.getVolumeType())) {

Review Comment:
   @weizhouapache for ROOT disk and ISO we are already setting the 
diskoffering. This PR change will only affect with VM deployed from templates 
having multiple disks.
   In older version we were returning DATA disk's offering as disk offering
   
   ```
   (localcloud) 🐱 > list managementservers 
   {
     "count": 1,
     "managementserver": [
       {
         "id": "8d7b1557-cf29-44b6-8d35-876d1959d7f4",
         "name": "ghost",
         "state": "Up",
         "version": "4.16.0.0"
       }
     ]
   }
   (localcloud) 🐱 > list volumes 
virtualmachineid=8f411a8b-4fb5-4b23-9909-f6c9ccc62d0a 
filter=id,name,diskofferingid,type,
   {
     "count": 2,
     "volume": [
       {
         "diskofferingid": "f32c64b7-22bd-4057-9456-e15773986455",
         "id": "8414beca-a378-48c5-bbaf-42bdbcff5dc7",
         "name": "DATA-3",
         "type": "DATADISK"
       },
       {
         "id": "14a335c2-ad48-4d33-abfd-ec9b45e9be20",
         "name": "ROOT-3",
         "type": "ROOT"
       }
     ]
   }
   (localcloud) 🐱 > list virtualmachines 
id=8f411a8b-4fb5-4b23-9909-f6c9ccc62d0a 
filter=id,name,diskofferingid,diskofferingname,
   {
     "count": 1,
     "virtualmachine": [
       {
         "diskofferingid": "f32c64b7-22bd-4057-9456-e15773986455",
         "diskofferingname": "Medium",
         "id": "8f411a8b-4fb5-4b23-9909-f6c9ccc62d0a",
         "name": "VM-8f411a8b-4fb5-4b23-9909-f6c9ccc62d0a"
       }
     ]
   }
   (localcloud) 🐱 > list virtualmachines 
id=8f411a8b-4fb5-4b23-9909-f6c9ccc62d0a 
filter=id,name,diskofferingid,diskofferingname,templateid,templatename,
   {
     "count": 1,
     "virtualmachine": [
       {
         "diskofferingid": "f32c64b7-22bd-4057-9456-e15773986455",
         "diskofferingname": "Medium",
         "id": "8f411a8b-4fb5-4b23-9909-f6c9ccc62d0a",
         "name": "VM-8f411a8b-4fb5-4b23-9909-f6c9ccc62d0a",
         "templateid": "cb8d1d7a-9370-11ee-9baf-9843fa67404e",
         "templatename": "CentOS 5.6 (64-bit) no GUI (Simulator)"
       }
     ]
   }
   ```



##########
server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java:
##########
@@ -550,6 +552,11 @@ public UserVmResponse setUserVmResponse(ResponseView view, 
UserVmResponse userVm
             userVmData.addAffinityGroup(resp);
         }
 
+        if (StringUtils.isEmpty(userVmData.getDiskOfferingId()) && 
!Volume.Type.ROOT.equals(uvo.getVolumeType())) {

Review Comment:
   @weizhouapache for ROOT disk and ISO we are already setting the 
diskoffering. This PR change will only affect with VM deployed from templates 
having multiple disks.
   In older version we were returning DATA disk's offering as disk offering
   
   ```
   (localcloud) 🐱 > list managementservers 
   {
     "count": 1,
     "managementserver": [
       {
         "id": "8d7b1557-cf29-44b6-8d35-876d1959d7f4",
         "name": "ghost",
         "state": "Up",
         "version": "4.16.0.0"
       }
     ]
   }
   (localcloud) 🐱 > list volumes 
virtualmachineid=8f411a8b-4fb5-4b23-9909-f6c9ccc62d0a 
filter=id,name,diskofferingid,type,
   {
     "count": 2,
     "volume": [
       {
         "diskofferingid": "f32c64b7-22bd-4057-9456-e15773986455",
         "id": "8414beca-a378-48c5-bbaf-42bdbcff5dc7",
         "name": "DATA-3",
         "type": "DATADISK"
       },
       {
         "id": "14a335c2-ad48-4d33-abfd-ec9b45e9be20",
         "name": "ROOT-3",
         "type": "ROOT"
       }
     ]
   }
   (localcloud) 🐱 > list virtualmachines 
id=8f411a8b-4fb5-4b23-9909-f6c9ccc62d0a 
filter=id,name,diskofferingid,diskofferingname,
   {
     "count": 1,
     "virtualmachine": [
       {
         "diskofferingid": "f32c64b7-22bd-4057-9456-e15773986455",
         "diskofferingname": "Medium",
         "id": "8f411a8b-4fb5-4b23-9909-f6c9ccc62d0a",
         "name": "VM-8f411a8b-4fb5-4b23-9909-f6c9ccc62d0a"
       }
     ]
   }
   (localcloud) 🐱 > list virtualmachines 
id=8f411a8b-4fb5-4b23-9909-f6c9ccc62d0a 
filter=id,name,diskofferingid,diskofferingname,templateid,templatename,
   {
     "count": 1,
     "virtualmachine": [
       {
         "diskofferingid": "f32c64b7-22bd-4057-9456-e15773986455",
         "diskofferingname": "Medium",
         "id": "8f411a8b-4fb5-4b23-9909-f6c9ccc62d0a",
         "name": "VM-8f411a8b-4fb5-4b23-9909-f6c9ccc62d0a",
         "templateid": "cb8d1d7a-9370-11ee-9baf-9843fa67404e",
         "templatename": "CentOS 5.6 (64-bit) no GUI (Simulator)"
       }
     ]
   }
   ```



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