Skip to content

Commit c8eb5f2

Browse files
committed
add global setting to allow parallel execution on vmware
1 parent 1ead6c1 commit c8eb5f2

5 files changed

Lines changed: 33 additions & 5 deletions

File tree

api/src/main/java/com/cloud/hypervisor/HypervisorGuru.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
public interface HypervisorGuru extends Adapter {
3838
ConfigKey<Boolean> VmwareFullClone = new ConfigKey<Boolean>("Advanced", Boolean.class, "vmware.create.full.clone", "true",
3939
"If set to true, creates guest VMs as full clones on ESX", false);
40+
4041
HypervisorType getHypervisorType();
4142

4243
/**

engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ public interface CapacityManager {
9292
static final ConfigKey<Float> SecondaryStorageCapacityThreshold = new ConfigKey<Float>("Advanced", Float.class, "secondary.storage.capacity.threshold", "0.90",
9393
"Percentage (as a value between 0 and 1) of secondary storage capacity threshold.", true);
9494

95+
public static final ConfigKey<Boolean> vmwareAllowParallelExecution = new ConfigKey<Boolean>("Advanced", Boolean.class, "vmware.allow.parallel.copy.command.execution", "false",
96+
"allow copy command to be executed in parallel in spite of 'vmware.create.full.clone' being set to false.", true, ConfigKey.Scope.Global);
97+
9598
public boolean releaseVmCapacity(VirtualMachine vm, boolean moveFromReserved, boolean moveToReservered, Long hostId);
9699

97100
void allocateVmCapacity(VirtualMachine vm, boolean fromLastHost);

engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,8 +1557,9 @@ public boolean getExecuteInSequence(final HypervisorType hypervisorType) {
15571557
case LXC:
15581558
return false;
15591559
case VMware:
1560-
final Boolean fullClone = HypervisorGuru.VmwareFullClone.value();
1561-
return fullClone;
1560+
final Boolean fullClone = getFullCloneConfiguration();
1561+
final Boolean allowParallel = getAllowParallelExecutionConfiguration();
1562+
return fullClone && !allowParallel;
15621563
default:
15631564
return ExecuteInSequence.value();
15641565
}
@@ -1645,6 +1646,16 @@ private void unmanageVMNics(VirtualMachineProfile profile, VMInstanceVO vm) {
16451646
_networkMgr.unmanageNics(profile);
16461647
}
16471648

1649+
Boolean getAllowParallelExecutionConfiguration() {
1650+
final Boolean allowParallel = CapacityManager.vmwareAllowParallelExecution.value();
1651+
return allowParallel;
1652+
}
1653+
1654+
Boolean getFullCloneConfiguration() {
1655+
final Boolean fullClone = CapacityManager.VmwareCreateCloneFull.value();
1656+
return fullClone;
1657+
}
1658+
16481659
private List<Map<String, String>> getVolumesToDisconnect(VirtualMachine vm) {
16491660
List<Map<String, String>> volumesToDisconnect = new ArrayList<>();
16501661

engine/orchestration/src/test/java/com/cloud/vm/VirtualMachineManagerImplTest.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
5757
import com.cloud.host.HostVO;
5858
import com.cloud.hypervisor.Hypervisor.HypervisorType;
59-
import com.cloud.hypervisor.HypervisorGuru;
6059
import com.cloud.service.ServiceOfferingVO;
6160
import com.cloud.service.dao.ServiceOfferingDao;
6261
import com.cloud.storage.DiskOfferingVO;
@@ -209,9 +208,23 @@ public void testSendStopWithNullAnswer() throws Exception {
209208
public void testExeceuteInSequence() {
210209
assertTrue(virtualMachineManagerImpl.getExecuteInSequence(HypervisorType.XenServer) == false);
211210
assertTrue(virtualMachineManagerImpl.getExecuteInSequence(HypervisorType.KVM) == false);
212-
assertTrue(virtualMachineManagerImpl.getExecuteInSequence(HypervisorType.VMware) == HypervisorGuru.VmwareFullClone.value());
213211
assertTrue(virtualMachineManagerImpl.getExecuteInSequence(HypervisorType.Ovm3) == VirtualMachineManager.ExecuteInSequence.value());
214212
}
213+
@Test
214+
public void testExeceuteInSequenceVmware() {
215+
when(virtualMachineManagerImpl.getFullCloneConfiguration()).thenReturn(Boolean.FALSE);
216+
when(virtualMachineManagerImpl.getAllowParallelExecutionConfiguration()).thenReturn(Boolean.FALSE);
217+
assertFalse("no full clones so no need to execute in sequence", virtualMachineManagerImpl.getExecuteInSequence(HypervisorType.VMware));
218+
when(virtualMachineManagerImpl.getFullCloneConfiguration()).thenReturn(Boolean.TRUE);
219+
when(virtualMachineManagerImpl.getAllowParallelExecutionConfiguration()).thenReturn(Boolean.FALSE);
220+
assertTrue("full clones and no explicit parallel execution allowed, should execute in sequence", virtualMachineManagerImpl.getExecuteInSequence(HypervisorType.VMware));
221+
when(virtualMachineManagerImpl.getFullCloneConfiguration()).thenReturn(Boolean.TRUE);
222+
when(virtualMachineManagerImpl.getAllowParallelExecutionConfiguration()).thenReturn(Boolean.TRUE);
223+
assertFalse("execute in sequence should not be needed as parallel is allowed", virtualMachineManagerImpl.getExecuteInSequence(HypervisorType.VMware));
224+
when(virtualMachineManagerImpl.getFullCloneConfiguration()).thenReturn(Boolean.FALSE);
225+
when(virtualMachineManagerImpl.getAllowParallelExecutionConfiguration()).thenReturn(Boolean.TRUE);
226+
assertFalse("double reasons to allow parallel execution", virtualMachineManagerImpl.getExecuteInSequence(HypervisorType.VMware));
227+
}
215228

216229
@Test
217230
public void testCheckIfCanUpgrade() throws Exception {

server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,6 @@ public String getConfigComponentName() {
12561256
@Override
12571257
public ConfigKey<?>[] getConfigKeys() {
12581258
return new ConfigKey<?>[] {CpuOverprovisioningFactor, MemOverprovisioningFactor, StorageCapacityDisableThreshold, StorageOverprovisioningFactor,
1259-
StorageAllocatedCapacityDisableThreshold, StorageOperationsExcludeCluster, VmwareCreateCloneFull, ImageStoreNFSVersion, SecondaryStorageCapacityThreshold};
1259+
StorageAllocatedCapacityDisableThreshold, StorageOperationsExcludeCluster, VmwareCreateCloneFull, ImageStoreNFSVersion, SecondaryStorageCapacityThreshold, vmwareAllowParallelExecution};
12601260
}
12611261
}

0 commit comments

Comments
 (0)