Skip to content

Commit 5c3593c

Browse files
committed
address comments
1 parent d1982db commit 5c3593c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6589,10 +6589,7 @@ private VMInstanceVO preVmStorageMigrationCheck(Long vmId) {
65896589
}
65906590

65916591
HypervisorType hypervisorType = vm.getHypervisorType();
6592-
if (vm.getType() != VirtualMachine.Type.User &&
6593-
(!hypervisorType.isFunctionalitySupported(HypervisorType.Functionality.VmStorageMigration)
6594-
|| hypervisorType.equals(HypervisorType.XenServer))) {
6595-
6592+
if (!hypervisorSupportsNonUserVMStorageMigration(vm, hypervisorType)) {
65966593
List<HypervisorType> supportedHypervisors = HypervisorType.getListOfHypervisorsSupportingFunctionality(HypervisorType.Functionality.VmStorageMigration)
65976594
.stream().filter(hypervisor -> !hypervisor.equals(HypervisorType.XenServer)).collect(Collectors.toList());
65986595
throw new InvalidParameterValueException(String.format(
@@ -6614,6 +6611,12 @@ private VMInstanceVO preVmStorageMigrationCheck(Long vmId) {
66146611
return vm;
66156612
}
66166613

6614+
private boolean hypervisorSupportsNonUserVMStorageMigration(VirtualMachine vm, HypervisorType hypervisorType) {
6615+
return vm.getType() == VirtualMachine.Type.User ||
6616+
(hypervisorType.isFunctionalitySupported(HypervisorType.Functionality.VmStorageMigration)
6617+
&& !hypervisorType.equals(HypervisorType.XenServer));
6618+
}
6619+
66176620
private VirtualMachine findMigratedVm(long vmId, VirtualMachine.Type vmType) {
66186621
if (VirtualMachine.Type.User.equals(vmType)) {
66196622
return _vmDao.findById(vmId);

0 commit comments

Comments
 (0)