slavkap commented on a change in pull request #4491:
URL: https://github.com/apache/cloudstack/pull/4491#discussion_r529251798



##########
File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -1177,6 +1167,23 @@ private UserVm upgradeStoppedVirtualMachine(Long vmId, 
Long svcOffId, Map<String
 
     }
 
+    private void resizeVolumeWithNewOfferings(VMInstanceVO vmInstance, 
ServiceOfferingVO newServiceOffering)
+            throws ResourceAllocationException {
+        DiskOfferingVO newROOTDiskOffering = 
_diskOfferingDao.findById(newServiceOffering.getId());
+
+        List<VolumeVO> vols = 
_volsDao.findReadyRootVolumesByInstance(vmInstance.getId());
+
+        for (final VolumeVO rootVolumeOfVm : vols) {
+            rootVolumeOfVm.setDiskOfferingId(newROOTDiskOffering.getId());
+
+            _volsDao.update(rootVolumeOfVm.getId(), rootVolumeOfVm);
+
+            ResizeVolumeCmd resizeVolumeCmd = new 
ResizeVolumeCmd(rootVolumeOfVm.getId(), newROOTDiskOffering.getMinIops(), 
newROOTDiskOffering.getMaxIops());
+
+            _volumeService.resizeVolume(resizeVolumeCmd);

Review comment:
       thanks @sureshanaparti for the code review! I will move the update of 
new disk offerings after the resizeVolume, but maybe I need to move the method 
invocation of resizeVolumeWithNewOfferings before upgradeVMDb (like how it's 
invoked in upgradeStoppedVirtualMachine)?




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to