You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2020/11/24 07:23:14 UTC

[GitHub] [cloudstack] slavkap commented on a change in pull request #4491: fix on changeServiceForVirtualMachnie when updating read/write rate

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:
users@infra.apache.org