disable parallel for xenserver. Also for vmware, if full.clone is enabled and migratecommand will have the behavor of start/stop command

This commit is contained in:
Edison Su 2014-10-09 17:14:57 -07:00
parent 6b8e0baa21
commit d233f39c82
4 changed files with 22 additions and 3 deletions

View File

@ -18,6 +18,8 @@ package com.cloud.hypervisor;
import java.util.List;
import org.apache.cloudstack.framework.config.ConfigKey;
import com.cloud.agent.api.Command;
import com.cloud.agent.api.to.NicTO;
import com.cloud.agent.api.to.VirtualMachineTO;
@ -29,6 +31,8 @@ import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public interface HypervisorGuru extends Adapter {
static final ConfigKey<Boolean> VmwareFullClone = new ConfigKey<Boolean>("Advanced", Boolean.class, "vmware.create.full.clone", "true",
"If set to true, creates guest VMs as full clones on ESX", false);
HypervisorType getHypervisorType();
/**

View File

@ -1206,8 +1206,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
protected boolean getExecuteInSequence(HypervisorType hypervisorType) {
if (HypervisorType.KVM == hypervisorType || HypervisorType.LXC == hypervisorType) {
if (HypervisorType.KVM == hypervisorType || HypervisorType.LXC == hypervisorType || HypervisorType.XenServer == hypervisorType) {
return false;
} else if(HypervisorType.VMware == hypervisorType) {
Boolean fullClone = HypervisorGuru.VmwareFullClone.value();
return fullClone;
} else {
return ExecuteInSequence.value();
}
@ -1898,7 +1901,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
boolean migrated = false;
try {
boolean isWindows = _guestOsCategoryDao.findById(_guestOsDao.findById(vm.getGuestOSId()).getCategoryId()).getName().equalsIgnoreCase("Windows");
MigrateCommand mc = new MigrateCommand(vm.getInstanceName(), dest.getHost().getPrivateIpAddress(), isWindows, to, ExecuteInSequence.value());
MigrateCommand mc = new MigrateCommand(vm.getInstanceName(), dest.getHost().getPrivateIpAddress(), isWindows, to, getExecuteInSequence(vm.getHypervisorType()));
mc.setHostGuid(dest.getHost().getGuid());
try {
@ -3285,7 +3288,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
boolean migrated = false;
try {
boolean isWindows = _guestOsCategoryDao.findById(_guestOsDao.findById(vm.getGuestOSId()).getCategoryId()).getName().equalsIgnoreCase("Windows");
MigrateCommand mc = new MigrateCommand(vm.getInstanceName(), dest.getHost().getPrivateIpAddress(), isWindows, to, ExecuteInSequence.value());
MigrateCommand mc = new MigrateCommand(vm.getInstanceName(), dest.getHost().getPrivateIpAddress(), isWindows, to, getExecuteInSequence(vm.getHypervisorType()));
mc.setHostGuid(dest.getHost().getGuid());
try {

View File

@ -27,6 +27,7 @@ import java.util.UUID;
import javax.ejb.Local;
import javax.inject.Inject;
import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
import org.apache.log4j.Logger;
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStore;
@ -368,6 +369,12 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru, Co
public Pair<Boolean, Long> getCommandHostDelegation(long hostId, Command cmd) {
boolean needDelegation = false;
if (cmd instanceof StorageSubSystemCommand) {
Boolean fullCloneEnabled = VmwareFullClone.value();
StorageSubSystemCommand c = (StorageSubSystemCommand)cmd;
c.setExecuteInSequence(fullCloneEnabled);
}
//NOTE: the hostid can be a hypervisor host, or a ssvm agent. For copycommand, if it's for volume upload, the hypervisor
//type is empty, so we need to check the format of volume at first.
if (cmd instanceof CopyCommand) {

View File

@ -29,6 +29,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
import org.apache.cloudstack.hypervisor.xenserver.XenserverConfigs;
import org.apache.cloudstack.storage.command.CopyCommand;
import org.apache.cloudstack.storage.command.DettachCommand;
import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
@ -149,6 +150,10 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru
@Override
public Pair<Boolean, Long> getCommandHostDelegation(long hostId, Command cmd) {
if (cmd instanceof StorageSubSystemCommand) {
StorageSubSystemCommand c = (StorageSubSystemCommand)cmd;
c.setExecuteInSequence(true);
}
if (cmd instanceof CopyCommand) {
CopyCommand cpyCommand = (CopyCommand)cmd;
DataTO srcData = cpyCommand.getSrcTO();