server: fix root disk size on vm reset#4638
Conversation
On resize of ROOT volume add detail in the VM for `rootdisksize` which will allow resizing root disk when VM reset is performed. Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
|
code looks good @shwstppr but have you verified that the resize code is being called on a vm reset? |
|
@DaanHoogland I stopped work on this after your comment on the issue and reconsidering reset behaviour. |
|
@shwstppr (cc @Spaceman1984 ) the consensus so far is to revert to the template including the template root size disk. making it optional is outside of this scope. |
…ize wasn't overridden during deployment
|
@blueorangutan package |
1 similar comment
|
@blueorangutan package |
|
@Pearl1594 a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ centos7 ✔️ debian. SL-JID 271 |
|
@blueorangutan test centos7 vmware-67u3 |
|
@Pearl1594 a Trillian-Jenkins test job (centos7 mgmt + vmware-67u3) has been kicked to run smoke tests |
|
Trillian test result (tid-276)
|
|
@blueorangutan test centos7 vmware-67u3 |
|
@Pearl1594 a Trillian-Jenkins test job (centos7 mgmt + vmware-67u3) has been kicked to run smoke tests |
|
Trillian test result (tid-306)
|
DaanHoogland
left a comment
There was a problem hiding this comment.
looks good, doing a new build/smoke test run on kvm
|
Packaging result: ✔️ centos7 ✔️ debian. SL-JID 371 |
There was a problem hiding this comment.
Verified behavior. LGTM
- Created a VM with a template of size 3GB but overrode root disk size to 8GB. Reinstalled the VM. The re-installed VM's root disk size = 8GB
- Created a VM with a template of size 3GB but overrode root disk size to 8GB. Performed a volume resize operation - volume size (root) = 15GB. Reinstalled VM - the reinstalled VM's root volume size = 15GB
- Created a VM with a template of size 3GB. Resized the volume of the VM to 8GB. Reinstalled the VM. Re-installed VM's root disk size = 3GB - DB updated as well
| 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); |
There was a problem hiding this comment.
@shwstppr it is possible to handle this case while allocating duplicate volume with template ?
There was a problem hiding this comment.
@sureshanaparti Duplicating using template, won't that affect other existing values of the entry - folder, path, etc?
There was a problem hiding this comment.
I missed this comment, if we need to address anything additional pl raise a new PR @shwstppr @sureshanaparti
|
|
||
| // 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())); |
There was a problem hiding this comment.
newVol here doesn't have updated template size, refresh it after the template size is updated in DB.
There was a problem hiding this comment.
@sureshanaparti same object is been cast to VolumeVO and size is updated at 6682-6683. newVol will return the updated size
|
Merged based on Daan, Pearl's review testing and smoketests |
If VM details contain rootdisksize, volume entry in DB should reflect correct size when VM reset is performed. Fixes apache#3957 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> Co-authored-by: Pearl Dsilva <pearl.dsilva@shapeblue.com>
Description
If VM details contain
rootdisksize, volume entry in DB should reflect correct size when VM reset is performed.Fixes #3957
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?