From 3b8d2202dcd75cf7d8a316d9650c143cbddffc6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Jandre?= <48719461+JoaoJandre@users.noreply.github.com> Date: Wed, 12 Jun 2024 07:41:09 -0300 Subject: [PATCH] fix unwanted kvm root volume migration (#8908) --- .../main/java/com/cloud/vm/VirtualMachineManagerImpl.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java index 0613b9586ff..09c3e37bed9 100755 --- a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java @@ -3007,7 +3007,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac executeManagedStorageChecksWhenTargetStoragePoolNotProvided(targetHost, currentPool, volume); if (ScopeType.HOST.equals(currentPool.getScope()) || isStorageCrossClusterMigration(plan.getClusterId(), currentPool)) { createVolumeToStoragePoolMappingIfPossible(profile, plan, volumeToPoolObjectMap, volume, currentPool); - } else if (shouldMapVolume(profile, volume, currentPool)){ + } else if (shouldMapVolume(profile, currentPool)){ volumeToPoolObjectMap.put(volume, currentPool); } } @@ -3019,11 +3019,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac * Some context: VMware migration workflow requires all volumes to be mapped (even if volume stays on its current pool); * however, this is not necessary/desirable for the KVM flow. */ - protected boolean shouldMapVolume(VirtualMachineProfile profile, Volume volume, StoragePoolVO currentPool) { + protected boolean shouldMapVolume(VirtualMachineProfile profile, StoragePoolVO currentPool) { boolean isManaged = currentPool.isManaged(); boolean isNotKvm = HypervisorType.KVM != profile.getHypervisorType(); - boolean isNotDatadisk = Type.DATADISK != volume.getVolumeType(); - return isNotKvm || isNotDatadisk || isManaged; + return isNotKvm || isManaged; } /**