sureshanaparti commented on a change in pull request #4491:
URL: https://github.com/apache/cloudstack/pull/4491#discussion_r529203961
##########
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:
@slavkap In case any failure in the ResizeVolumeCmd execution, the
volume will still point to the new offering. So, better to update the new
offering in the volume after ResizeVolumeCmd execution is successful.
----------------------------------------------------------------
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]