use of io.cloudslang.content.vmware.entities.SyncProgressUpdater in project cs-actions by CloudSlang.
the class DeployOvfTemplateService method deployOvfTemplate.
public void deployOvfTemplate(final HttpInputs httpInputs, final VmInputs vmInputs, final String templatePath, final Map<String, String> ovfNetworkMap, final Map<String, String> ovfPropertyMap) throws Exception {
final ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs);
try {
final ImmutablePair<ManagedObjectReference, OvfCreateImportSpecResult> pair = createLeaseSetup(connectionResources, vmInputs, templatePath, ovfNetworkMap, ovfPropertyMap);
final ManagedObjectReference httpNfcLease = pair.getLeft();
final OvfCreateImportSpecResult importSpecResult = pair.getRight();
final HttpNfcLeaseInfo httpNfcLeaseInfo = getHttpNfcLeaseInfoWhenReady(connectionResources, httpNfcLease);
final List<HttpNfcLeaseDeviceUrl> deviceUrls = httpNfcLeaseInfo.getDeviceUrl();
final ProgressUpdater progressUpdater = executor.isParallel() ? new AsyncProgressUpdater(getDisksTotalNoBytes(importSpecResult), httpNfcLease, connectionResources) : new SyncProgressUpdater(getDisksTotalNoBytes(importSpecResult), httpNfcLease, connectionResources);
executor.execute(progressUpdater);
transferVmdkFiles(templatePath, importSpecResult, deviceUrls, progressUpdater);
executor.shutdown();
} finally {
if (httpInputs.isCloseSession()) {
connectionResources.getConnection().disconnect();
clearConnectionFromContext(httpInputs.getGlobalSessionObject());
}
}
}
Aggregations