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

(cherry picked from commit d233f39c82908f81ba90f51d7bc445cc83ef5691)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1c1485e0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1c1485e0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1c1485e0

Branch: refs/heads/master
Commit: 1c1485e0f0c098b522f8461bb7c69f8b8efd7f77
Parents: c10189f
Author: Edison Su <sudi...@gmail.com>
Authored: Thu Oct 9 17:14:57 2014 -0700
Committer: David Nalley <da...@gnsa.us>
Committed: Mon Oct 13 00:39:33 2014 -0400

----------------------------------------------------------------------
 api/src/com/cloud/hypervisor/HypervisorGuru.java            | 4 ++++
 .../src/com/cloud/vm/VirtualMachineManagerImpl.java         | 9 ++++++---
 .../vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java    | 7 +++++++
 .../xenserver/src/com/cloud/hypervisor/XenServerGuru.java   | 5 +++++
 4 files changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1c1485e0/api/src/com/cloud/hypervisor/HypervisorGuru.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/hypervisor/HypervisorGuru.java 
b/api/src/com/cloud/hypervisor/HypervisorGuru.java
index 4a35cec..583e082 100644
--- a/api/src/com/cloud/hypervisor/HypervisorGuru.java
+++ b/api/src/com/cloud/hypervisor/HypervisorGuru.java
@@ -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();
 
     /**

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1c1485e0/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java 
b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 5de1e51..fdf5665 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -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 {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1c1485e0/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java 
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
index abc7cdb..63ee707 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
@@ -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) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1c1485e0/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/XenServerGuru.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/XenServerGuru.java 
b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/XenServerGuru.java
index c1de8bb..4019edc 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/XenServerGuru.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/XenServerGuru.java
@@ -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();

Reply via email to