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.

This commit is contained in:
Devdeep Singh 2013-05-22 17:25:01 +05:30
parent f7eb139ce2
commit 85ff507094

View File

@ -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