-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix hardcoded max data volumes when VM has been created but not started before #3494
New issue
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
Changes from all commits
c327286
5e2c301
5fa201c
6a33826
dd1b028
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -266,6 +266,8 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic | |
|
|
||
| private List<StoragePoolAllocator> _storagePoolAllocators; | ||
|
|
||
| private List<HypervisorType> supportingDefaultHV; | ||
|
|
||
| VmWorkJobHandlerProxy _jobHandlerProxy = new VmWorkJobHandlerProxy(this); | ||
|
|
||
| static final ConfigKey<Long> VmJobCheckInterval = new ConfigKey<Long>("Advanced", Long.class, "vm.job.check.interval", "3000", "Interval in milliseconds to check if the job is complete", false); | ||
|
|
@@ -2861,7 +2863,9 @@ private VolumeVO sendAttachVolumeCommand(UserVmVO vm, VolumeVO volumeToAttach, L | |
| } | ||
| } | ||
|
|
||
| verifyManagedStorage(volumeToAttachStoragePool.getId(), hostId); | ||
| if (volumeToAttachStoragePool != null) { | ||
| verifyManagedStorage(volumeToAttachStoragePool.getId(), hostId); | ||
| } | ||
|
|
||
| // volumeToAttachStoragePool should be null if the VM we are attaching the disk to has never been started before | ||
| DataStore dataStore = volumeToAttachStoragePool != null ? dataStoreMgr.getDataStore(volumeToAttachStoragePool.getId(), DataStoreRole.Primary) : null; | ||
|
|
@@ -3007,6 +3011,11 @@ private int getMaxDataVolumesSupported(UserVmVO vm) { | |
| if (host != null) { | ||
| _hostDao.loadDetails(host); | ||
| maxDataVolumesSupported = _hypervisorCapabilitiesDao.getMaxDataVolumesLimit(host.getHypervisorType(), host.getDetail("product_version")); | ||
| } else { | ||
| HypervisorType hypervisorType = vm.getHypervisorType(); | ||
| if (hypervisorType != null && CollectionUtils.isNotEmpty(supportingDefaultHV) && supportingDefaultHV.contains(hypervisorType)) { | ||
| maxDataVolumesSupported = _hypervisorCapabilitiesDao.getMaxDataVolumesLimit(hypervisorType, "default"); | ||
|
Member
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. Could version specific values cause regression or bug?
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. if these are lower the "default", yes @rhtyd. But that should never be the case, should it?
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. Good point, I've verified any version contains max limit lower than the default for each hypervisor |
||
| } | ||
| } | ||
| if (maxDataVolumesSupported == null || maxDataVolumesSupported.intValue() <= 0) { | ||
| maxDataVolumesSupported = 6; // 6 data disks by default if nothing | ||
|
|
@@ -3054,6 +3063,7 @@ private Long getDeviceId(UserVmVO vm, Long deviceId) { | |
| public boolean configure(String name, Map<String, Object> params) { | ||
| String maxVolumeSizeInGbString = _configDao.getValue(Config.MaxVolumeSize.toString()); | ||
| _maxVolumeSizeInGb = NumbersUtil.parseLong(maxVolumeSizeInGbString, 2000); | ||
| supportingDefaultHV = _hypervisorCapabilitiesDao.getHypervisorsWithDefaultEntries(); | ||
| return true; | ||
| } | ||
|
|
||
|
|
||
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.
Is there a possibility of high frequency calls to this method? If so we can perhaps optimize query calls with some caching? If not LGTM
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.
Thanks @anuragaw, have refactored it to invoke this only once