CLOUDSTACK-4470, findHostsForMigration api isn't setting the requiresStorageMotion flag to true when a virtual machine is to be migrated across cluster and the source and destination host do not share storage pools. migrationRequired flag was introduced in a recent commit that was always set to false for XenServer. This caused the destination host to be flaged as not requiring storage motion. Fixed the scope of the boolean and defaulted it to true. Other checks validate if storage motion is required for XenServer.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5b319ba0 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5b319ba0 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5b319ba0 Branch: refs/heads/4.2 Commit: 5b319ba0cb46160451ec05de32a8409b44a08f5b Parents: 4a8119c Author: Devdeep Singh <[email protected]> Authored: Fri Aug 23 15:12:59 2013 +0530 Committer: Devdeep Singh <[email protected]> Committed: Fri Aug 23 15:12:59 2013 +0530 ---------------------------------------------------------------------- server/src/com/cloud/server/ManagementServerImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5b319ba0/server/src/com/cloud/server/ManagementServerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index f90926d..ddceeff 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -1116,7 +1116,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe List<HostVO> allHosts = null; Map<Host, Boolean> requiresStorageMotion = new HashMap<Host, Boolean>(); DataCenterDeployment plan = null; - boolean migrationRequired = false; if (canMigrateWithStorage) { allHostsPair = searchForServers(startIndex, pageSize, null, hostType, null, srcHost.getDataCenterId(), null, null, null, null, null, null, srcHost.getHypervisorType(), srcHost.getHypervisorVersion()); @@ -1130,10 +1129,12 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe if (volumePools.isEmpty()) { iterator.remove(); } else { + boolean migrationRequired = true; if (srcHost.getHypervisorType() == HypervisorType.VMware || srcHost.getHypervisorType() == HypervisorType.KVM) { // Check if each volume required migrating to other pool or not. migrationRequired = checkIfMigrationRequired(volumePools); } + if ((!host.getClusterId().equals(srcHost.getClusterId()) || usesLocal) && migrationRequired) { requiresStorageMotion.put(host, true); }
