Skip to content

Commit de41a6f

Browse files
committed
address comments
1 parent d1982db commit de41a6f

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

server/src/main/java/com/cloud/vm/UserVmManagerImpl.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// under the License.
1717
package com.cloud.vm;
1818

19+
import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality;
1920
import static com.cloud.storage.Volume.IOPS_LIMIT;
2021
import static com.cloud.utils.NumbersUtil.toHumanReadableSize;
2122
import static org.apache.cloudstack.api.ApiConstants.MAX_IOPS;
@@ -4546,7 +4547,7 @@ protected long configureCustomRootDiskSize(Map<String, String> customParameters,
45464547
* @throws InvalidParameterValueException if the hypervisor does not support rootdisksize override
45474548
*/
45484549
protected void verifyIfHypervisorSupportsRootdiskSizeOverride(HypervisorType hypervisorType) {
4549-
if (!hypervisorType.isFunctionalitySupported(HypervisorType.Functionality.RootDiskSizeOverride)) {
4550+
if (!hypervisorType.isFunctionalitySupported(Functionality.RootDiskSizeOverride)) {
45504551
throw new InvalidParameterValueException("Hypervisor " + hypervisorType + " does not support rootdisksize override");
45514552
}
45524553
}
@@ -6589,15 +6590,12 @@ private VMInstanceVO preVmStorageMigrationCheck(Long vmId) {
65896590
}
65906591

65916592
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)) {
65986596
throw new InvalidParameterValueException(String.format(
65996597
"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));
66016599
}
66026600

66036601
List<VolumeVO> vols = _volsDao.findByInstance(vm.getId());
@@ -7307,11 +7305,11 @@ public VirtualMachine migrateVirtualMachineWithVolume(Long vmId, Host destinatio
73077305
throw new InvalidParameterValueException("Live Migration of GPU enabled VM is not supported");
73087306
}
73097307

7310-
if (!vm.getHypervisorType().isFunctionalitySupported(HypervisorType.Functionality.VmStorageMigration)) {
7308+
if (!vm.getHypervisorType().isFunctionalitySupported(Functionality.VmStorageMigration)) {
73117309
throw new InvalidParameterValueException(
73127310
String.format("Unsupported hypervisor: %s for VM migration, we support [%s] only",
73137311
vm.getHypervisorType(),
7314-
HypervisorType.getListOfHypervisorsSupportingFunctionality(HypervisorType.Functionality.VmStorageMigration)));
7312+
HypervisorType.getListOfHypervisorsSupportingFunctionality(Functionality.VmStorageMigration)));
73157313
}
73167314

73177315
if (_vmSnapshotDao.findByVm(vmId).size() > 0) {

0 commit comments

Comments
 (0)