@Test public void testCreateLeaseSetupWithClusterName() throws Exception { prepareMocksForCreateLeaseSetupTest(true); ImmutablePair<ManagedObjectReference, OvfCreateImportSpecResult> result = serviceSpy.createLeaseSetup(connectionResourcesMock, vmInputsMock, PATH, ovfNetworkMapMock, ovfPropertyMapMock); verifyMockInvocationsForCreateLeaseSetupTest(result, true); }
protected ImmutablePair<ManagedObjectReference, OvfCreateImportSpecResult> createLeaseSetup( final ConnectionResources connectionResources, final VmInputs vmInputs, final String templatePath, final Map<String, String> ovfNetworkMap, final Map<String, String> ovfPropertyMap) throws Exception { final ManagedObjectReference ovfManager = getOvfManager(connectionResources); final VmUtils vmUtils = new VmUtils(); final ManagedObjectReference resourcePool; if (StringUtilities.isBlank(vmInputs.getClusterName())) { resourcePool = vmUtils.getMorResourcePool(vmInputs.getResourcePool(), connectionResources); } else { ManagedObjectReference clusterMor = new MorObjectHandler().getSpecificMor(connectionResources, connectionResources.getMorRootFolder(), ClusterParameter.CLUSTER_COMPUTE_RESOURCE.getValue(), vmInputs.getClusterName()); resourcePool = vmUtils.getMorResourcePoolFromCluster(connectionResources, clusterMor, vmInputs.getResourcePool()); } final ManagedObjectReference hostMor = vmUtils.getMorHost(vmInputs.getHostname(), connectionResources, null); final ManagedObjectReference datastoreMor = vmUtils.getMorDataStore(vmInputs.getDataStore(), connectionResources, null, vmInputs); final ManagedObjectReference folderMor = vmUtils.getMorFolder(vmInputs.getFolderName(), connectionResources); final List<OvfNetworkMapping> ovfNetworkMappings = getOvfNetworkMappings(ovfNetworkMap, connectionResources); final List<KeyValue> ovfPropertyMappings = getOvfPropertyMappings(ovfPropertyMap); final OvfCreateImportSpecResult importSpecResult = connectionResources.getVimPortType() .createImportSpec(ovfManager, getOvfTemplateAsString(templatePath), resourcePool, datastoreMor, getOvfCreateImportSpecParams(vmInputs, hostMor, ovfNetworkMappings, ovfPropertyMappings)); checkImportSpecResultForErrors(importSpecResult); final ManagedObjectReference httpNfcLease = OvfUtils.getHttpNfcLease(connectionResources, importSpecResult.getImportSpec(), resourcePool, hostMor, folderMor); return ImmutablePair.of(httpNfcLease, importSpecResult); }
DeployOvfTemplateService { protected ImmutablePair<ManagedObjectReference, OvfCreateImportSpecResult> createLeaseSetup( final ConnectionResources connectionResources, final VmInputs vmInputs, final String templatePath, final Map<String, String> ovfNetworkMap, final Map<String, String> ovfPropertyMap) throws Exception { final ManagedObjectReference ovfManager = getOvfManager(connectionResources); final VmUtils vmUtils = new VmUtils(); final ManagedObjectReference resourcePool; if (StringUtilities.isBlank(vmInputs.getClusterName())) { resourcePool = vmUtils.getMorResourcePool(vmInputs.getResourcePool(), connectionResources); } else { ManagedObjectReference clusterMor = new MorObjectHandler().getSpecificMor(connectionResources, connectionResources.getMorRootFolder(), ClusterParameter.CLUSTER_COMPUTE_RESOURCE.getValue(), vmInputs.getClusterName()); resourcePool = vmUtils.getMorResourcePoolFromCluster(connectionResources, clusterMor, vmInputs.getResourcePool()); } final ManagedObjectReference hostMor = vmUtils.getMorHost(vmInputs.getHostname(), connectionResources, null); final ManagedObjectReference datastoreMor = vmUtils.getMorDataStore(vmInputs.getDataStore(), connectionResources, null, vmInputs); final ManagedObjectReference folderMor = vmUtils.getMorFolder(vmInputs.getFolderName(), connectionResources); final List<OvfNetworkMapping> ovfNetworkMappings = getOvfNetworkMappings(ovfNetworkMap, connectionResources); final List<KeyValue> ovfPropertyMappings = getOvfPropertyMappings(ovfPropertyMap); final OvfCreateImportSpecResult importSpecResult = connectionResources.getVimPortType() .createImportSpec(ovfManager, getOvfTemplateAsString(templatePath), resourcePool, datastoreMor, getOvfCreateImportSpecParams(vmInputs, hostMor, ovfNetworkMappings, ovfPropertyMappings)); checkImportSpecResultForErrors(importSpecResult); final ManagedObjectReference httpNfcLease = OvfUtils.getHttpNfcLease(connectionResources, importSpecResult.getImportSpec(), resourcePool, hostMor, folderMor); return ImmutablePair.of(httpNfcLease, importSpecResult); } }
DeployOvfTemplateService { protected ImmutablePair<ManagedObjectReference, OvfCreateImportSpecResult> createLeaseSetup( final ConnectionResources connectionResources, final VmInputs vmInputs, final String templatePath, final Map<String, String> ovfNetworkMap, final Map<String, String> ovfPropertyMap) throws Exception { final ManagedObjectReference ovfManager = getOvfManager(connectionResources); final VmUtils vmUtils = new VmUtils(); final ManagedObjectReference resourcePool; if (StringUtilities.isBlank(vmInputs.getClusterName())) { resourcePool = vmUtils.getMorResourcePool(vmInputs.getResourcePool(), connectionResources); } else { ManagedObjectReference clusterMor = new MorObjectHandler().getSpecificMor(connectionResources, connectionResources.getMorRootFolder(), ClusterParameter.CLUSTER_COMPUTE_RESOURCE.getValue(), vmInputs.getClusterName()); resourcePool = vmUtils.getMorResourcePoolFromCluster(connectionResources, clusterMor, vmInputs.getResourcePool()); } final ManagedObjectReference hostMor = vmUtils.getMorHost(vmInputs.getHostname(), connectionResources, null); final ManagedObjectReference datastoreMor = vmUtils.getMorDataStore(vmInputs.getDataStore(), connectionResources, null, vmInputs); final ManagedObjectReference folderMor = vmUtils.getMorFolder(vmInputs.getFolderName(), connectionResources); final List<OvfNetworkMapping> ovfNetworkMappings = getOvfNetworkMappings(ovfNetworkMap, connectionResources); final List<KeyValue> ovfPropertyMappings = getOvfPropertyMappings(ovfPropertyMap); final OvfCreateImportSpecResult importSpecResult = connectionResources.getVimPortType() .createImportSpec(ovfManager, getOvfTemplateAsString(templatePath), resourcePool, datastoreMor, getOvfCreateImportSpecParams(vmInputs, hostMor, ovfNetworkMappings, ovfPropertyMappings)); checkImportSpecResultForErrors(importSpecResult); final ManagedObjectReference httpNfcLease = OvfUtils.getHttpNfcLease(connectionResources, importSpecResult.getImportSpec(), resourcePool, hostMor, folderMor); return ImmutablePair.of(httpNfcLease, importSpecResult); } DeployOvfTemplateService(final boolean parallel); }
DeployOvfTemplateService { protected ImmutablePair<ManagedObjectReference, OvfCreateImportSpecResult> createLeaseSetup( final ConnectionResources connectionResources, final VmInputs vmInputs, final String templatePath, final Map<String, String> ovfNetworkMap, final Map<String, String> ovfPropertyMap) throws Exception { final ManagedObjectReference ovfManager = getOvfManager(connectionResources); final VmUtils vmUtils = new VmUtils(); final ManagedObjectReference resourcePool; if (StringUtilities.isBlank(vmInputs.getClusterName())) { resourcePool = vmUtils.getMorResourcePool(vmInputs.getResourcePool(), connectionResources); } else { ManagedObjectReference clusterMor = new MorObjectHandler().getSpecificMor(connectionResources, connectionResources.getMorRootFolder(), ClusterParameter.CLUSTER_COMPUTE_RESOURCE.getValue(), vmInputs.getClusterName()); resourcePool = vmUtils.getMorResourcePoolFromCluster(connectionResources, clusterMor, vmInputs.getResourcePool()); } final ManagedObjectReference hostMor = vmUtils.getMorHost(vmInputs.getHostname(), connectionResources, null); final ManagedObjectReference datastoreMor = vmUtils.getMorDataStore(vmInputs.getDataStore(), connectionResources, null, vmInputs); final ManagedObjectReference folderMor = vmUtils.getMorFolder(vmInputs.getFolderName(), connectionResources); final List<OvfNetworkMapping> ovfNetworkMappings = getOvfNetworkMappings(ovfNetworkMap, connectionResources); final List<KeyValue> ovfPropertyMappings = getOvfPropertyMappings(ovfPropertyMap); final OvfCreateImportSpecResult importSpecResult = connectionResources.getVimPortType() .createImportSpec(ovfManager, getOvfTemplateAsString(templatePath), resourcePool, datastoreMor, getOvfCreateImportSpecParams(vmInputs, hostMor, ovfNetworkMappings, ovfPropertyMappings)); checkImportSpecResultForErrors(importSpecResult); final ManagedObjectReference httpNfcLease = OvfUtils.getHttpNfcLease(connectionResources, importSpecResult.getImportSpec(), resourcePool, hostMor, folderMor); return ImmutablePair.of(httpNfcLease, importSpecResult); } DeployOvfTemplateService(final boolean parallel); void deployOvfTemplate(final HttpInputs httpInputs, final VmInputs vmInputs, final String templatePath,
                                  final Map<String, String> ovfNetworkMap, final Map<String, String> ovfPropertyMap); }
DeployOvfTemplateService { protected ImmutablePair<ManagedObjectReference, OvfCreateImportSpecResult> createLeaseSetup( final ConnectionResources connectionResources, final VmInputs vmInputs, final String templatePath, final Map<String, String> ovfNetworkMap, final Map<String, String> ovfPropertyMap) throws Exception { final ManagedObjectReference ovfManager = getOvfManager(connectionResources); final VmUtils vmUtils = new VmUtils(); final ManagedObjectReference resourcePool; if (StringUtilities.isBlank(vmInputs.getClusterName())) { resourcePool = vmUtils.getMorResourcePool(vmInputs.getResourcePool(), connectionResources); } else { ManagedObjectReference clusterMor = new MorObjectHandler().getSpecificMor(connectionResources, connectionResources.getMorRootFolder(), ClusterParameter.CLUSTER_COMPUTE_RESOURCE.getValue(), vmInputs.getClusterName()); resourcePool = vmUtils.getMorResourcePoolFromCluster(connectionResources, clusterMor, vmInputs.getResourcePool()); } final ManagedObjectReference hostMor = vmUtils.getMorHost(vmInputs.getHostname(), connectionResources, null); final ManagedObjectReference datastoreMor = vmUtils.getMorDataStore(vmInputs.getDataStore(), connectionResources, null, vmInputs); final ManagedObjectReference folderMor = vmUtils.getMorFolder(vmInputs.getFolderName(), connectionResources); final List<OvfNetworkMapping> ovfNetworkMappings = getOvfNetworkMappings(ovfNetworkMap, connectionResources); final List<KeyValue> ovfPropertyMappings = getOvfPropertyMappings(ovfPropertyMap); final OvfCreateImportSpecResult importSpecResult = connectionResources.getVimPortType() .createImportSpec(ovfManager, getOvfTemplateAsString(templatePath), resourcePool, datastoreMor, getOvfCreateImportSpecParams(vmInputs, hostMor, ovfNetworkMappings, ovfPropertyMappings)); checkImportSpecResultForErrors(importSpecResult); final ManagedObjectReference httpNfcLease = OvfUtils.getHttpNfcLease(connectionResources, importSpecResult.getImportSpec(), resourcePool, hostMor, folderMor); return ImmutablePair.of(httpNfcLease, importSpecResult); } DeployOvfTemplateService(final boolean parallel); void deployOvfTemplate(final HttpInputs httpInputs, final VmInputs vmInputs, final String templatePath,
                                  final Map<String, String> ovfNetworkMap, final Map<String, String> ovfPropertyMap);  }