CLOUDSTACK-3944: fix regression for vmware

This commit is contained in:
Edison Su 2013-07-30 11:34:19 -07:00
parent 1e1ee902a2
commit c42f51d75b
1 changed files with 7 additions and 12 deletions

View File

@ -300,11 +300,6 @@ 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();
@ -312,12 +307,6 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru {
DataTO destData = cpyCommand.getDestTO();
DataStoreTO destStoreTO = destData.getDataStore();
if ((HypervisorType.VMware == srcData.getHypervisorType() ||
HypervisorType.VMware == destData.getHypervisorType()
)) {
needDelegation = true;
}
if (srcData.getObjectType() == DataObjectType.VOLUME) {
VolumeObjectTO volumeObjectTO = (VolumeObjectTO)srcData;
if (Storage.ImageFormat.OVA == volumeObjectTO.getFormat()) {
@ -325,6 +314,12 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru {
}
}
if (!needDelegation && !(HypervisorType.VMware == srcData.getHypervisorType() ||
HypervisorType.VMware == destData.getHypervisorType()
)) {
return new Pair<Boolean, Long>(Boolean.FALSE, new Long(hostId));
}
if (destData.getObjectType() == DataObjectType.VOLUME && destStoreTO.getRole() == DataStoreRole.Primary &&
srcData.getObjectType() == DataObjectType.TEMPLATE && srcStoreTO.getRole() == DataStoreRole.Primary) {
needDelegation = false;
@ -347,7 +342,7 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru {
if(!needDelegation) {
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) {