| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -3511,27 +3511,17 @@ public UserVmVO doInTransaction(TransactionStatus status) throws InsufficientCap | |
| } | ||
| rootDiskSize = Long.parseLong(customParameters.get("rootdisksize")); | ||
|
|
||
| // only KVM supports rootdisksize override | ||
| if (hypervisorType != HypervisorType.KVM) { | ||
| throw new InvalidParameterValueException("Hypervisor " + hypervisorType + " does not support rootdisksize override"); | ||
| // only KVM, XenServer and VMware supports rootdisksize override | ||
| if (!(hypervisorType == HypervisorType.KVM || hypervisorType == HypervisorType.XenServer || hypervisorType == HypervisorType.VMware)) { | ||
| throw new InvalidParameterValueException("Hypervisor " + hypervisorType + " does not support rootdisksize override"); | ||
|
Comment thread
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThe condition in VolumeApiServiceImpl.java at line# 1029 above and this doesn't match. You skipped None and Any. Is that intentional?
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality@sureshanaparti both are serving different purpose. Yes, It is intentional.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality@priyankparihar Ok. thanks for the confirmation
Sorry, something went wrong.
All reactions
|
||
| } | ||
|
|
||
| // rotdisksize must be larger than template | ||
| VMTemplateVO templateVO = _templateDao.findById(template.getId()); | ||
| if (templateVO == null) { | ||
| throw new InvalidParameterValueException("Unable to look up template by id " + template.getId()); | ||
| } | ||
|
|
||
| if ((rootDiskSize << 30) < templateVO.getSize()) { | ||
| Long templateVOSizeGB = templateVO.getSize() / 1024 / 1024 / 1024; | ||
| throw new InvalidParameterValueException("unsupported: rootdisksize override is smaller than template size " + templateVO.getSize() | ||
| + "B (" + templateVOSizeGB + "GB)"); | ||
| } else { | ||
| s_logger.debug("rootdisksize of " + (rootDiskSize << 30) + " was larger than template size of " + templateVO.getSize()); | ||
| } | ||
|
|
||
| s_logger.debug("found root disk size of " + rootDiskSize); | ||
| customParameters.remove("rootdisksize"); | ||
| validateRootDiskResize(hypervisorType, rootDiskSize, templateVO, vm, customParameters); | ||
| } | ||
|
|
||
| if (isDisplayVm != null) { | ||
| Expand Down Expand Up | @@ -3614,6 +3604,29 @@ public UserVmVO doInTransaction(TransactionStatus status) throws InsufficientCap | |
| }); | ||
| } | ||
|
|
||
| public void validateRootDiskResize(final HypervisorType hypervisorType, Long rootDiskSize, VMTemplateVO templateVO, UserVmVO vm, final Map<String, String> customParameters) throws InvalidParameterValueException | ||
| { | ||
| // rootdisksize must be larger than template. | ||
| if ((rootDiskSize << 30) < templateVO.getSize()) { | ||
| Long templateVOSizeGB = templateVO.getSize() / 1024 / 1024 / 1024; | ||
| s_logger.error("unsupported: rootdisksize override is smaller than template size " + templateVO.getSize() + "B (" + templateVOSizeGB + "GB)"); | ||
| throw new InvalidParameterValueException("unsupported: rootdisksize override is smaller than template size " + templateVO.getSize() + "B (" + templateVOSizeGB + "GB)"); | ||
| } else if ((rootDiskSize << 30) > templateVO.getSize()) { | ||
| if (hypervisorType == HypervisorType.VMware && (vm.getDetails() == null || vm.getDetails().get("rootDiskController") == null)) { | ||
| s_logger.warn("If Root disk controller parameter is not overridden, then Root disk resize may fail because current Root disk controller value is NULL."); | ||
| } else if (hypervisorType == HypervisorType.VMware && !vm.getDetails().get("rootDiskController").toLowerCase().contains("scsi")) { | ||
| s_logger.error("Found unsupported root disk controller : " + vm.getDetails().get("rootDiskController")); | ||
| throw new InvalidParameterValueException("Found unsupported root disk controller :" + vm.getDetails().get("rootDiskController")); | ||
| } else { | ||
| s_logger.debug("Rootdisksize override validation successful. Template root disk size "+(templateVO.getSize() / 1024 / 1024 / 1024)+ " GB" + " Root disk size specified "+ rootDiskSize+" GB"); | ||
| } | ||
| } else { | ||
| s_logger.debug("Root disk size specified is " + (rootDiskSize << 30) + " and Template root disk size is " + templateVO.getSize()+" . Both are equal so no need to override"); | ||
| customParameters.remove("rootdisksize"); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| @Override | ||
| public void generateUsageEvent(VirtualMachine vm, boolean isDisplay, String eventType){ | ||
| ServiceOfferingVO serviceOffering = _offeringDao.findById(vm.getId(), vm.getServiceOfferingId()); | ||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityWhy was XS blocked before?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality@pdube There was no resource layer code available for XS for this and root volume resize was only implemented for KVM.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.