|
16 | 16 | // under the License. |
17 | 17 | package com.cloud.vm; |
18 | 18 |
|
| 19 | +import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality; |
19 | 20 | import static com.cloud.storage.Volume.IOPS_LIMIT; |
20 | 21 | import static com.cloud.utils.NumbersUtil.toHumanReadableSize; |
21 | 22 | import static org.apache.cloudstack.api.ApiConstants.MAX_IOPS; |
@@ -4546,7 +4547,7 @@ protected long configureCustomRootDiskSize(Map<String, String> customParameters, |
4546 | 4547 | * @throws InvalidParameterValueException if the hypervisor does not support rootdisksize override |
4547 | 4548 | */ |
4548 | 4549 | protected void verifyIfHypervisorSupportsRootdiskSizeOverride(HypervisorType hypervisorType) { |
4549 | | - if (!hypervisorType.isFunctionalitySupported(HypervisorType.Functionality.RootDiskSizeOverride)) { |
| 4550 | + if (!hypervisorType.isFunctionalitySupported(Functionality.RootDiskSizeOverride)) { |
4550 | 4551 | throw new InvalidParameterValueException("Hypervisor " + hypervisorType + " does not support rootdisksize override"); |
4551 | 4552 | } |
4552 | 4553 | } |
@@ -6589,15 +6590,12 @@ private VMInstanceVO preVmStorageMigrationCheck(Long vmId) { |
6589 | 6590 | } |
6590 | 6591 |
|
6591 | 6592 | HypervisorType hypervisorType = vm.getHypervisorType(); |
6592 | | - if (vm.getType() != VirtualMachine.Type.User && |
6593 | | - (!hypervisorType.isFunctionalitySupported(HypervisorType.Functionality.VmStorageMigration) |
6594 | | - || hypervisorType.equals(HypervisorType.XenServer))) { |
6595 | | - |
6596 | | - List<HypervisorType> supportedHypervisors = HypervisorType.getListOfHypervisorsSupportingFunctionality(HypervisorType.Functionality.VmStorageMigration) |
6597 | | - .stream().filter(hypervisor -> !hypervisor.equals(HypervisorType.XenServer)).collect(Collectors.toList()); |
| 6593 | + List<HypervisorType> supportedHypervisorsForNonUserVMStorageMigration = HypervisorType.getListOfHypervisorsSupportingFunctionality(Functionality.VmStorageMigration) |
| 6594 | + .stream().filter(hypervisor -> !hypervisor.equals(HypervisorType.XenServer)).collect(Collectors.toList()); |
| 6595 | + if (vm.getType() != VirtualMachine.Type.User && !supportedHypervisorsForNonUserVMStorageMigration.contains(hypervisorType)) { |
6598 | 6596 | throw new InvalidParameterValueException(String.format( |
6599 | 6597 | "Unable to migrate storage of non-user VMs for hypervisor [%s]. Operation only supported for the following hypervisors: [%s].", |
6600 | | - hypervisorType, supportedHypervisors)); |
| 6598 | + hypervisorType, supportedHypervisorsForNonUserVMStorageMigration)); |
6601 | 6599 | } |
6602 | 6600 |
|
6603 | 6601 | List<VolumeVO> vols = _volsDao.findByInstance(vm.getId()); |
@@ -7307,11 +7305,11 @@ public VirtualMachine migrateVirtualMachineWithVolume(Long vmId, Host destinatio |
7307 | 7305 | throw new InvalidParameterValueException("Live Migration of GPU enabled VM is not supported"); |
7308 | 7306 | } |
7309 | 7307 |
|
7310 | | - if (!vm.getHypervisorType().isFunctionalitySupported(HypervisorType.Functionality.VmStorageMigration)) { |
| 7308 | + if (!vm.getHypervisorType().isFunctionalitySupported(Functionality.VmStorageMigration)) { |
7311 | 7309 | throw new InvalidParameterValueException( |
7312 | 7310 | String.format("Unsupported hypervisor: %s for VM migration, we support [%s] only", |
7313 | 7311 | vm.getHypervisorType(), |
7314 | | - HypervisorType.getListOfHypervisorsSupportingFunctionality(HypervisorType.Functionality.VmStorageMigration))); |
| 7312 | + HypervisorType.getListOfHypervisorsSupportingFunctionality(Functionality.VmStorageMigration))); |
7315 | 7313 | } |
7316 | 7314 |
|
7317 | 7315 | if (_vmSnapshotDao.findByVm(vmId).size() > 0) { |
|
0 commit comments