Skip to content

Commit 534eda4

Browse files
shwstpprdhslove
authored andcommitted
server: allow migration of vm with snapshots for vmware (apache#9305)
Fixes apache#9061 Signed-off-by: Abhishek Kumar <[email protected]>
1 parent 4098e4c commit 534eda4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

api/src/main/java/com/cloud/hypervisor/Hypervisor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,22 @@
3131
import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality.DirectDownloadTemplate;
3232
import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality.RootDiskSizeOverride;
3333
import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality.VmStorageMigration;
34+
import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality.VmStorageMigrationWithSnapshots;
3435

3536
public class Hypervisor {
3637
public static class HypervisorType {
3738
public enum Functionality {
3839
DirectDownloadTemplate,
3940
RootDiskSizeOverride,
40-
VmStorageMigration
41+
VmStorageMigration,
42+
VmStorageMigrationWithSnapshots
4143
}
4244

4345
private static final Map<String, HypervisorType> hypervisorTypeMap = new LinkedHashMap<>();
4446
public static final HypervisorType None = new HypervisorType("None"); //for storage hosts
4547
public static final HypervisorType XenServer = new HypervisorType("XenServer", ImageFormat.VHD, EnumSet.of(RootDiskSizeOverride, VmStorageMigration));
4648
public static final HypervisorType KVM = new HypervisorType("KVM", ImageFormat.QCOW2, EnumSet.of(DirectDownloadTemplate, RootDiskSizeOverride, VmStorageMigration));
47-
public static final HypervisorType VMware = new HypervisorType("VMware", ImageFormat.OVA, EnumSet.of(RootDiskSizeOverride, VmStorageMigration));
49+
public static final HypervisorType VMware = new HypervisorType("VMware", ImageFormat.OVA, EnumSet.of(RootDiskSizeOverride, VmStorageMigration, VmStorageMigrationWithSnapshots));
4850
public static final HypervisorType Hyperv = new HypervisorType("Hyperv");
4951
public static final HypervisorType VirtualBox = new HypervisorType("VirtualBox");
5052
public static final HypervisorType Parralels = new HypervisorType("Parralels");

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7898,7 +7898,8 @@ public VirtualMachine migrateVirtualMachineWithVolume(Long vmId, Host destinatio
78987898
HypervisorType.getListOfHypervisorsSupportingFunctionality(Functionality.VmStorageMigration)));
78997899
}
79007900

7901-
if (_vmSnapshotDao.findByVm(vmId).size() > 0) {
7901+
if (!vm.getHypervisorType().isFunctionalitySupported(Functionality.VmStorageMigrationWithSnapshots) &&
7902+
CollectionUtils.isNotEmpty(_vmSnapshotDao.findByVm(vmId))) {
79027903
throw new InvalidParameterValueException("VM with VM Snapshots cannot be migrated with storage, please remove all VM snapshots");
79037904
}
79047905

0 commit comments

Comments
 (0)