Skip to content

Commit e87b167

Browse files
committed
CLOUDSTACK-3568: [Automation]Parallel deployment - Vmware - When
deploying 30 parallel Vms , we see ~15 Vms fail in org.apache.cloudstack.storage.command.CopyCommand.
1 parent c657243 commit e87b167

2 files changed

Lines changed: 128 additions & 100 deletions

File tree

engine/api/src/org/apache/cloudstack/storage/command/CopyCommand.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@
1616
// under the License.
1717
package org.apache.cloudstack.storage.command;
1818

19+
import org.apache.cloudstack.storage.to.TemplateObjectTO;
20+
import org.apache.cloudstack.storage.to.VolumeObjectTO;
21+
1922
import com.cloud.agent.api.Command;
2023
import com.cloud.agent.api.to.DataTO;
24+
import com.cloud.hypervisor.Hypervisor.HypervisorType;
25+
import com.cloud.storage.DataStoreRole;
2126

2227
public final class CopyCommand extends Command implements StorageSubSystemCommand {
2328
private DataTO srcTO;
@@ -31,7 +36,18 @@ public CopyCommand(DataTO srcData, DataTO destData, int timeout, boolean execute
3136
this.srcTO = srcData;
3237
this.destTO = destData;
3338
this.setWait(timeout);
34-
this.executeInSequence = executeInSequence;
39+
this.executeInSequence = executeInSequence; // default is to run in parallel, so false here
40+
// special handling for vmware parallel vm deployment bug https://issues.apache.org/jira/browse/CLOUDSTACK-3568
41+
if (srcTO instanceof TemplateObjectTO && destTO instanceof VolumeObjectTO) {
42+
// create a volume wrapper vm from a template on primary storage
43+
TemplateObjectTO srcTmplt = (TemplateObjectTO) srcTO;
44+
VolumeObjectTO destVol = (VolumeObjectTO) destTO;
45+
if (srcTmplt.getHypervisorType() == HypervisorType.VMware && srcTmplt.getDataStore().getRole() == DataStoreRole.Primary
46+
&& destVol.getDataStore().getRole() == DataStoreRole.Primary) {
47+
this.executeInSequence = true;
48+
}
49+
}
50+
3551
}
3652

3753
public DataTO getDestTO() {

0 commit comments

Comments
 (0)