Updated Branches: refs/heads/4.2 c24db863a -> 73ec4ede6
CLOUDSTACK-3937: Attaching uploaded volume is failing The method getCommandHostDelegation(long hostId, Command cmid) got overidden in VmwareGuru.java as part of commit bfe30cd2e31906365a306d87fe331ccdcec5c33c. Earlier there was no HV specific implementation and copy volume from secondary to primary worked fine. With the Vmware specific change the code was getting hit even in case of XS and other hypervisors and failed with NPE. Now there is a check in the Vmware implementation to check if the HV is of type Vmware. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/73ec4ede Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/73ec4ede Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/73ec4ede Branch: refs/heads/4.2 Commit: 73ec4ede6654e58eca6d40ccb241bb71d05ce912 Parents: c24db86 Author: Koushik Das <[email protected]> Authored: Tue Jul 30 16:23:02 2013 +0530 Committer: Koushik Das <[email protected]> Committed: Tue Jul 30 16:34:28 2013 +0530 ---------------------------------------------------------------------- .../vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/73ec4ede/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java index e9495dc..2288642 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java @@ -300,6 +300,11 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru { public Pair<Boolean, Long> getCommandHostDelegation(long hostId, Command cmd) { boolean needDelegation = false; + HostVO host = _hostDao.findById(hostId); + if (host.getHypervisorType() != HypervisorType.VMware) { + return new Pair<Boolean, Long>(Boolean.FALSE, new Long(hostId)); + } + if (cmd instanceof CopyCommand) { CopyCommand cpyCommand = (CopyCommand)cmd; DataTO srcData = cpyCommand.getSrcTO(); @@ -343,9 +348,7 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru { return new Pair<Boolean, Long>(Boolean.FALSE, new Long(hostId)); } - HostVO host = _hostDao.findById(hostId); long dcId = host.getDataCenterId(); - Pair<HostVO, SecondaryStorageVmVO> cmdTarget = _secStorageMgr.assignSecStorageVm(dcId, cmd); if(cmdTarget != null) { // TODO, we need to make sure agent is actually connected too
