From 85ff50709424dc726b934d2d29f046d47b610d75 Mon Sep 17 00:00:00 2001 From: Devdeep Singh Date: Wed, 22 May 2013 17:25:01 +0530 Subject: [PATCH] CLOUDSTACK-2602. XenServer storage motion strategy returns true for canHandle even though hosts are of different hypervisor type. Fixed the canHandle routine to return true only if source and destination hosts are of type XenServer. --- .../storage/motion/XenServerStorageMotionStrategy.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java b/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java index 353f2b58d08..42cb68d1213 100644 --- a/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java +++ b/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java @@ -19,8 +19,8 @@ package org.apache.cloudstack.storage.motion; import java.util.HashMap; -import java.util.Map; import java.util.List; +import java.util.Map; import javax.inject.Inject; @@ -50,6 +50,7 @@ import com.cloud.agent.api.to.VolumeTO; import com.cloud.exception.AgentUnavailableException; import com.cloud.exception.OperationTimedoutException; import com.cloud.host.Host; +import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.storage.StoragePool; import com.cloud.storage.VolumeVO; import com.cloud.storage.dao.VolumeDao; @@ -73,7 +74,12 @@ public class XenServerStorageMotionStrategy implements DataMotionStrategy { @Override public boolean canHandle(Map volumeMap, Host srcHost, Host destHost) { - return true; + boolean canHandle = false; + if (srcHost.getHypervisorType() == HypervisorType.XenServer && + destHost.getHypervisorType() == HypervisorType.XenServer) { + canHandle = true; + } + return canHandle; } @Override