Merge remote-tracking branch 'origin/4.15'

This commit is contained in:
Rohit Yadav 2021-01-28 16:45:49 +05:30
commit be5e61a2f3
1 changed files with 13 additions and 0 deletions

View File

@ -1261,6 +1261,19 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
return resizeVolumeCmd;
}
private void resizeRootVolumeOfVmWithNewOffering(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());
ResizeVolumeCmd resizeVolumeCmd = new ResizeVolumeCmd(rootVolumeOfVm.getId(), newROOTDiskOffering.getMinIops(), newROOTDiskOffering.getMaxIops());
_volumeService.resizeVolume(resizeVolumeCmd);
_volsDao.update(rootVolumeOfVm.getId(), rootVolumeOfVm);
}
}
@Override
@ActionEvent(eventType = EventTypes.EVENT_NIC_CREATE, eventDescription = "Creating Nic", async = true)
public UserVm addNicToVirtualMachine(AddNicToVMCmd cmd) throws InvalidParameterValueException, PermissionDeniedException, CloudRuntimeException {