|
39 | 39 | import com.cloud.service.ServiceOfferingVO; |
40 | 40 | import com.cloud.service.dao.ServiceOfferingDao; |
41 | 41 | import com.cloud.vm.DiskProfile; |
| 42 | +import com.cloud.vm.UserVmDetailVO; |
42 | 43 | import org.apache.cloudstack.api.ApiErrorCode; |
43 | 44 | import org.apache.cloudstack.api.ServerApiException; |
44 | 45 | import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd; |
@@ -327,6 +328,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic |
327 | 328 | private final StateMachine2<Volume.State, Volume.Event, Volume> _volStateMachine; |
328 | 329 |
|
329 | 330 | private static final Set<Volume.State> STATES_VOLUME_CANNOT_BE_DESTROYED = new HashSet<>(Arrays.asList(Volume.State.Destroy, Volume.State.Expunging, Volume.State.Expunged, Volume.State.Allocated)); |
| 331 | + private static final long GiB_TO_BYTES = 1024 * 1024 * 1024; |
330 | 332 |
|
331 | 333 | protected VolumeApiServiceImpl() { |
332 | 334 | _volStateMachine = Volume.State.getStateMachine(); |
@@ -1381,6 +1383,13 @@ private VolumeVO orchestrateResizeVolume(long volumeId, long currentSize, long n |
1381 | 1383 | } |
1382 | 1384 |
|
1383 | 1385 | _volsDao.update(volume.getId(), volume); |
| 1386 | + if (userVm != null) { |
| 1387 | + UserVmDetailVO userVmDetailVO = userVmDetailsDao.findDetail(userVm.getId(), VmDetailConstants.ROOT_DISK_SIZE); |
| 1388 | + if (userVmDetailVO != null) { |
| 1389 | + userVmDetailVO.setValue(String.valueOf(newSize/ GiB_TO_BYTES)); |
| 1390 | + userVmDetailsDao.update(userVmDetailVO.getId(), userVmDetailVO); |
| 1391 | + } |
| 1392 | + } |
1384 | 1393 |
|
1385 | 1394 | /* Update resource count for the account on primary storage resource */ |
1386 | 1395 | if (!shrinkOk) { |
|
0 commit comments