Hi Edison, I have reverted this commit 23841e3369877e404e4c7f4000a1ee540d1dcfa8 because unit tests was failing.
--Sanjay -----Original Message----- From: edi...@apache.org [mailto:edi...@apache.org] Sent: Wednesday, January 1, 2014 3:34 AM To: comm...@cloudstack.apache.org Subject: git commit: updated refs/heads/4.3 to 23841e3 Updated Branches: refs/heads/4.3 309416071 -> 23841e336 CLOUDSTACK-5329: fix NPE, in case of zone wide primary storage Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/23841e33 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/23841e33 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/23841e33 Branch: refs/heads/4.3 Commit: 23841e3369877e404e4c7f4000a1ee540d1dcfa8 Parents: 3094160 Author: edison <sudi...@gmail.com> Authored: Tue Dec 31 13:59:33 2013 -0800 Committer: edison <sudi...@gmail.com> Committed: Tue Dec 31 14:03:44 2013 -0800 ---------------------------------------------------------------------- api/src/com/cloud/storage/StoragePool.java | 3 +++ server/src/com/cloud/vm/UserVmManagerImpl.java | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/23841e33/api/src/com/cloud/storage/StoragePool.java ---------------------------------------------------------------------- diff --git a/api/src/com/cloud/storage/StoragePool.java b/api/src/com/cloud/storage/StoragePool.java index 6e9af12..1f5713e 100644 --- a/api/src/com/cloud/storage/StoragePool.java +++ b/api/src/com/cloud/storage/StoragePool.java @@ -18,6 +18,7 @@ package com.cloud.storage; import java.util.Date; +import com.cloud.hypervisor.Hypervisor; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; @@ -104,4 +105,6 @@ public interface StoragePool extends Identity, InternalIdentity { String getStorageProviderName(); boolean isInMaintenance(); + + Hypervisor.HypervisorType getHypervisor(); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/23841e33/server/src/com/cloud/vm/UserVmManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 19285da..bd8cae1 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -36,6 +36,7 @@ import javax.naming.ConfigurationException; import com.cloud.capacity.Capacity; import com.cloud.exception.InsufficientServerCapacityException; +import org.apache.cloudstack.engine.subsystem.api.storage.*; import org.apache.commons.codec.binary.Base64; import org.apache.log4j.Logger; @@ -70,10 +71,6 @@ import org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntity; import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService; import org.apache.cloudstack.engine.service.api.OrchestrationService; -import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory; -import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; -import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; -import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService.VolumeApiResult; import org.apache.cloudstack.framework.async.AsyncCallFuture; import org.apache.cloudstack.framework.config.ConfigKey; @@ -4057,9 +4054,12 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir throw new InvalidParameterValueException( "Data disks attached to the vm, can not migrate. Need to dettach data disks at first"); } - - HypervisorType destHypervisorType = _clusterDao.findById( + HypervisorType destHypervisorType = destPool.getHypervisor(); + if (destHypervisorType == null) { + destHypervisorType = _clusterDao.findById( destPool.getClusterId()).getHypervisorType(); + } + if (vm.getHypervisorType() != destHypervisorType) { throw new InvalidParameterValueException( "hypervisor is not compatible: dest: "