shwstppr commented on a change in pull request #4638:
URL: https://github.com/apache/cloudstack/pull/4638#discussion_r610588460



##########
File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -6678,6 +6678,12 @@ public UserVm restoreVirtualMachine(final Account 
caller, final long vmId, final
                 newVol = volumeMgr.allocateDuplicateVolume(root, null);
             }
 
+            if (userVmDetailsDao.findDetail(vm.getId(), 
VmDetailConstants.ROOT_DISK_SIZE) == null && 
!newVol.getSize().equals(template.getSize())) {
+                VolumeVO resizedVolume = (VolumeVO) newVol;
+                resizedVolume.setSize(template.getSize());
+                _volsDao.update(resizedVolume.getId(), resizedVolume);
+            }
+
             // 1. Save usage event and update resource count for user vm 
volumes
             _resourceLimitMgr.incrementResourceCount(newVol.getAccountId(), 
ResourceType.volume, newVol.isDisplay());
             _resourceLimitMgr.incrementResourceCount(newVol.getAccountId(), 
ResourceType.primary_storage, newVol.isDisplay(), new Long(newVol.getSize()));

Review comment:
       @sureshanaparti same object is been cast to VolumeVO and size is updated 
 at 6682-6683. `newVol` will return the updated size




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