CLOUDSTACK-8964: Can't create template or volume from snapshot

This issue happens on KVM.
Normally the SSVM will process the CopyCommand from snapshot to template.
However, Ovm3HypervisorGuru chooses a KVM hypervisor to process the CopyCommand.
This is obviously wrong.
This commit is contained in:
Wei Zhou 2015-10-19 20:49:02 +02:00
parent ecc2e2f39d
commit ccf5d75cfb

View File

@ -28,6 +28,7 @@ import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.cloud.agent.api.Command;
import com.cloud.host.HostVO;
import com.cloud.host.dao.HostDao;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.utils.Pair;
@ -74,7 +75,9 @@ public class HypervisorGuruManagerImpl extends ManagerBase implements Hypervisor
@Override
public long getGuruProcessedCommandTargetHost(long hostId, Command cmd) {
for (HypervisorGuru guru : _hvGuruList) {
HostVO host = _hostDao.findById(hostId);
HypervisorGuru guru = getGuru(host.getHypervisorType());
if (guru != null) {
Pair<Boolean, Long> result = guru.getCommandHostDelegation(hostId, cmd);
if (result.first()) {
return result.second();