Java 类com.vmware.vim25.KeyValue 实例源码

项目:cloudstack    文件:LicenseAssignmentManagerMO.java   
public boolean isFeatureSupported(String featureKey, ManagedObjectReference hostMor) throws Exception {
    boolean featureSupported = false;

    // Retrieve host license properties
    List<KeyAnyValue> props = getHostLicenseProperties(hostMor);

    // Check host license properties to see if specified feature is supported by the license.
    for (KeyAnyValue prop : props) {
        String key = prop.getKey();
        if (key.equalsIgnoreCase(LICENSE_INFO_FEATURE)) {
            KeyValue propValue = (KeyValue)prop.getValue();
            if (propValue.getKey().equalsIgnoreCase(featureKey)) {
                featureSupported = true;
                break;
            }
        }
    }

    return featureSupported;
}
项目:cs-actions    文件:DeployOvfTemplateService.java   
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);
}
项目:cs-actions    文件:DeployOvfTemplateService.java   
private List<KeyValue> getOvfPropertyMappings(final Map<String, String> ovfPropertyMap) {
    final List<KeyValue> mappings = new ArrayList<>();
    for (Map.Entry<String, String> entry : ovfPropertyMap.entrySet()) {
        final KeyValue keyValue = new KeyValue();
        keyValue.setKey(entry.getKey());
        keyValue.setValue(entry.getValue());
        mappings.add(keyValue);
    }
    return mappings;
}
项目:cs-actions    文件:DeployOvfTemplateService.java   
private OvfCreateImportSpecParams getOvfCreateImportSpecParams(final VmInputs vmInputs, final ManagedObjectReference hostSystem,
                                                              final List ovfNetworkMappings, final List<KeyValue> ovfPropertyMappings) {
    final OvfCreateImportSpecParams params = new OvfCreateImportSpecParams();
    params.setHostSystem(hostSystem);
    params.setDeploymentOption("");
    params.setLocale(String.valueOf(vmInputs.getLocale()));
    params.setEntityName(vmInputs.getVirtualMachineName());
    params.setIpAllocationPolicy(vmInputs.getIpAllocScheme());
    params.setIpProtocol(vmInputs.getIpProtocol());
    params.setDiskProvisioning(vmInputs.getDiskProvisioning());
    params.getNetworkMapping().addAll(ovfNetworkMappings);
    params.getPropertyMapping().addAll(ovfPropertyMappings);
    return params;
}
项目:jcloud-vsphere    文件:LicenseManagerApi.java   
/**
 * @since SDK4.0
 */
LicenseManagerLicenseInfo addLicense(String licenseKey, KeyValue[] labels) throws RuntimeFault, RemoteException;
项目:jcloud-vsphere    文件:LicenseManagerApi.java   
/**
 * @since SDK4.0
 */
void updateLicense(String licenseKey, KeyValue[] labels) throws RuntimeFault, RemoteException;