|
16 | 16 | // under the License. |
17 | 17 | package com.cloud.vm; |
18 | 18 |
|
| 19 | +import static com.cloud.configuration.ConfigurationManager.VM_USERDATA_MAX_LENGTH; |
19 | 20 | import static com.cloud.configuration.ConfigurationManagerImpl.VM_USERDATA_MAX_LENGTH; |
20 | 21 | import static com.cloud.storage.Volume.IOPS_LIMIT; |
21 | 22 | import static com.cloud.utils.NumbersUtil.toHumanReadableSize; |
@@ -3992,7 +3993,7 @@ private UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOffe |
3992 | 3993 | throw new PermissionDeniedException("The owner of vm to deploy is disabled: " + owner); |
3993 | 3994 | } |
3994 | 3995 | VMTemplateVO template = _templateDao.findById(tmplt.getId()); |
3995 | | - if (!customParameters.isEmpty() && customParameters.containsKey("volumeId")){ |
| 3996 | + if (!MapUtils.isEmpty(customParameters) && customParameters.containsKey("volumeId")){ |
3996 | 3997 | template = _templateDao.findByIdIncludingRemoved(tmplt.getId()); |
3997 | 3998 | } |
3998 | 3999 |
|
@@ -4074,7 +4075,7 @@ private UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOffe |
4074 | 4075 | throw new InvalidParameterValueException("Root volume encryption is not supported for hypervisor type " + hypervisorType); |
4075 | 4076 | } |
4076 | 4077 |
|
4077 | | - if (!customParameters.isEmpty() && customParameters.containsKey("volumeId")){ |
| 4078 | + if (!MapUtils.isEmpty(customParameters) && customParameters.containsKey("volumeId")){ |
4078 | 4079 | Long volumeId = Long.valueOf(customParameters.get("volumeId")); |
4079 | 4080 | VolumeVO volume = _volsDao.findById(volumeId); |
4080 | 4081 | // Compute the size of the volume |
@@ -4498,7 +4499,7 @@ protected long configureCustomRootDiskSize(Map<String, String> customParameters, |
4498 | 4499 | _volumeService.validateVolumeSizeInBytes(rootDiskSize); |
4499 | 4500 | return rootDiskSize; |
4500 | 4501 | } else { |
4501 | | - if (!customParameters.isEmpty() && !customParameters.containsKey("volumeId")){ |
| 4502 | + if (!MapUtils.isEmpty(customParameters) && !customParameters.containsKey("volumeId")){ |
4502 | 4503 | // For baremetal, size can be 0 (zero) |
4503 | 4504 | Long templateSize = _templateDao.findById(template.getId()).getSize(); |
4504 | 4505 | if (templateSize != null) { |
@@ -4562,7 +4563,7 @@ private UserVmVO commitUserVm(final boolean isImport, final DataCenter zone, fin |
4562 | 4563 | offering.getLimitCpuUse(), owner.getDomainId(), owner.getId(), userId, offering.getId(), userData, userDataId, userDataDetails, hostName); |
4563 | 4564 | vm.setUuid(uuidName); |
4564 | 4565 | vm.setDynamicallyScalable(dynamicScalingEnabled); |
4565 | | - if (!customParameters.isEmpty() && customParameters.containsKey("volumeId")){ |
| 4566 | + if (!MapUtils.isEmpty(customParameters) && customParameters.containsKey("volumeId")){ |
4566 | 4567 | template = _templateDao.findByIdIncludingRemoved(template.getId()); |
4567 | 4568 | } |
4568 | 4569 | Map<String, String> details = template.getDetails(); |
|
0 commit comments