CLOUDSTACK-3937: Attaching uploaded volume is failing

The method getCommandHostDelegation(long hostId, Command cmid) got overidden in VmwareGuru.java as part of
commit bfe30cd2e3. 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.
This commit is contained in:
Koushik Das 2013-07-30 16:23:02 +05:30
parent 452176c0b4
commit 62a71e055b
1 changed files with 5 additions and 2 deletions

View File

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