Skip to content

Commit 73ec4ed

Browse files
committed
CLOUDSTACK-3937: Attaching uploaded volume is failing
The method getCommandHostDelegation(long hostId, Command cmid) got overidden in VmwareGuru.java as part of commit bfe30cd. 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.
1 parent c24db86 commit 73ec4ed

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,11 @@ public int compare(NicTO arg0, NicTO arg1) {
300300
public Pair<Boolean, Long> getCommandHostDelegation(long hostId, Command cmd) {
301301
boolean needDelegation = false;
302302

303+
HostVO host = _hostDao.findById(hostId);
304+
if (host.getHypervisorType() != HypervisorType.VMware) {
305+
return new Pair<Boolean, Long>(Boolean.FALSE, new Long(hostId));
306+
}
307+
303308
if (cmd instanceof CopyCommand) {
304309
CopyCommand cpyCommand = (CopyCommand)cmd;
305310
DataTO srcData = cpyCommand.getSrcTO();
@@ -343,9 +348,7 @@ public Pair<Boolean, Long> getCommandHostDelegation(long hostId, Command cmd) {
343348
return new Pair<Boolean, Long>(Boolean.FALSE, new Long(hostId));
344349
}
345350

346-
HostVO host = _hostDao.findById(hostId);
347351
long dcId = host.getDataCenterId();
348-
349352
Pair<HostVO, SecondaryStorageVmVO> cmdTarget = _secStorageMgr.assignSecStorageVm(dcId, cmd);
350353
if(cmdTarget != null) {
351354
// TODO, we need to make sure agent is actually connected too

0 commit comments

Comments
 (0)