Updated Branches:
  refs/heads/master f7eb139ce -> 85ff50709

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.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/85ff5070
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/85ff5070
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/85ff5070

Branch: refs/heads/master
Commit: 85ff50709424dc726b934d2d29f046d47b610d75
Parents: f7eb139
Author: Devdeep Singh <devd...@gmail.com>
Authored: Wed May 22 17:25:01 2013 +0530
Committer: Devdeep Singh <devd...@gmail.com>
Committed: Wed May 22 17:47:11 2013 +0530

----------------------------------------------------------------------
 .../motion/XenServerStorageMotionStrategy.java     |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/85ff5070/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java
----------------------------------------------------------------------
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 353f2b5..42cb68d 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<VolumeInfo, DataStore> volumeMap, Host 
srcHost, Host destHost) {
-        return true;
+        boolean canHandle = false;
+        if (srcHost.getHypervisorType() == HypervisorType.XenServer &&
+                destHost.getHypervisorType() == HypervisorType.XenServer) {
+            canHandle = true;
+        }
+        return canHandle;
     }
 
     @Override

Reply via email to