Java OptionValue类代码示例

本文整理汇总了Java中com.vmware.vim25.OptionValue的典型用法代码示例。如果您正苦于以下问题:Java OptionValue类的具体用法?Java OptionValue怎么用?Java OptionValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Java OptionValue类代码示例

OptionValue类属于com.vmware.vim25包,在下文中一共展示了OptionValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addVM

import com.vmware.vim25.OptionValue; //导入依赖的package包/类
public FakeVirtualMachine addVM(String name, boolean isRunning, VirtualMachineCloneSpec spec){
  final FakeVirtualMachine vm = new FakeVirtualMachine(name, name.contains("template"), isRunning);
  putVM(name, vm);
  if (spec != null && spec.getLocation()!= null
      && VirtualMachineRelocateDiskMoveOptions.createNewChildDiskBacking.name().equals(spec.getLocation().getDiskMoveType())){
    //((FakeVirtualMachine)vm).set
  }
  if (spec != null && spec.getConfig() != null) {
    final OptionValue[] extraConfig = spec.getConfig().getExtraConfig();
    if (extraConfig != null) {
      for (OptionValue optionValue : extraConfig) {
        vm.addCustomParam(optionValue.getKey(), String.valueOf(optionValue.getValue()));
      }
    }
  }

  return vm;
} 
开发者ID:JetBrains,项目名称:teamcity-vmware-plugin,代码行数:19,代码来源:FakeModel.java

示例2: getVncPort

import com.vmware.vim25.OptionValue; //导入依赖的package包/类
public Pair<String, Integer> getVncPort(String hostNetworkName) throws Exception {
    HostMO hostMo = getRunningHost();
    VmwareHypervisorHostNetworkSummary summary = hostMo.getHyperHostNetworkSummary(hostNetworkName);

    VirtualMachineConfigInfo configInfo = getConfigInfo();
    List<OptionValue> values = configInfo.getExtraConfig();

    if (values != null) {
        for (OptionValue option : values) {
            if (option.getKey().equals("RemoteDisplay.vnc.port")) {
                String value = (String)option.getValue();
                if (value != null) {
                    return new Pair<String, Integer>(summary.getHostIp(), Integer.parseInt(value));
                }
            }
        }
    }
    return new Pair<String, Integer>(summary.getHostIp(), 0);
} 
开发者ID:apache,项目名称:cloudstack,代码行数:20,代码来源:VirtualMachineMO.java

示例3: recordTimestamp

import com.vmware.vim25.OptionValue; //导入依赖的package包/类
/**
 * Stores a timestamp into a VM's extraConfig on provisioning.
 * Currently used for resource cleanup only.
 */
private void recordTimestamp(List<OptionValue> extraConfig) {
    if (extraConfig == null) {
        return;
    }

    OptionValue ov = new OptionValue();
    ov.setKey(EXTRA_CONFIG_CREATED);
    ov.setValue(Long.toString(System.currentTimeMillis()));
    extraConfig.add(ov);
} 
开发者ID:vmware,项目名称:photon-model,代码行数:15,代码来源:InstanceClient.java

示例4: recordSnapshotLimit

import com.vmware.vim25.OptionValue; //导入依赖的package包/类
private void recordSnapshotLimit(List<OptionValue> extraConfig, String snapshotLimitValue) {
    if (snapshotLimitValue != null && !snapshotLimitValue.isEmpty()) {
        if (extraConfig == null) {
            extraConfig = new ArrayList<>();
        }
        extraConfig.add(populateSnapshotLimitValue(snapshotLimitValue));
    }
} 
开发者ID:vmware,项目名称:photon-model,代码行数:9,代码来源:InstanceClient.java

示例5: getOVFParamValue

import com.vmware.vim25.OptionValue; //导入依赖的package包/类
public static String getOVFParamValue(VirtualMachineConfigSpec config) {
    String paramVal = "";
    List<OptionValue> options = config.getExtraConfig();
    for (OptionValue option : options) {
        if (OVA_OPTION_KEY_BOOTDISK.equalsIgnoreCase(option.getKey())) {
            paramVal = (String)option.getValue();
            break;
        }
    }
    return paramVal;
} 
开发者ID:apache,项目名称:cloudstack,代码行数:12,代码来源:HypervisorHostHelper.java

示例6: setVncConfigInfo

import com.vmware.vim25.OptionValue; //导入依赖的package包/类
public boolean setVncConfigInfo(boolean enableVnc, String vncPassword, int vncPort, String keyboard) throws Exception {
    VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
    OptionValue[] vncOptions = VmwareHelper.composeVncOptions(null, enableVnc, vncPassword, vncPort, keyboard);
    vmConfigSpec.getExtraConfig().addAll(Arrays.asList(vncOptions));
    ManagedObjectReference morTask = _context.getService().reconfigVMTask(_mor, vmConfigSpec);

    boolean result = _context.getVimClient().waitForTask(morTask);
    if (result) {
        _context.waitForTaskProgressDone(morTask);
        return true;
    } else {
        s_logger.error("VMware reconfigVM_Task failed due to " + TaskMO.getTaskFailureInfo(_context, morTask));
    }
    return false;
} 
开发者ID:apache,项目名称:cloudstack,代码行数:16,代码来源:VirtualMachineMO.java

示例7: getVmVncPortsOnCluster

import com.vmware.vim25.OptionValue; //导入依赖的package包/类
public HashMap<String, Integer> getVmVncPortsOnCluster() throws Exception {
    ObjectContent[] ocs = getVmPropertiesOnHyperHost(new String[] {"name", "config.extraConfig[\"RemoteDisplay.vnc.port\"]"});

    HashMap<String, Integer> portInfo = new HashMap<String, Integer>();
    if (ocs != null && ocs.length > 0) {
        for (ObjectContent oc : ocs) {
            List<DynamicProperty> objProps = oc.getPropSet();
            if (objProps != null) {
                String name = null;
                String value = null;
                for (DynamicProperty objProp : objProps) {
                    if (objProp.getName().equals("name")) {
                        name = (String)objProp.getVal();
                    } else {
                        OptionValue optValue = (OptionValue)objProp.getVal();
                        value = (String)optValue.getValue();
                    }
                }

                if (name != null && value != null) {
                    portInfo.put(name, Integer.parseInt(value));
                }
            }
        }
    }

    return portInfo;
} 
开发者ID:apache,项目名称:cloudstack,代码行数:29,代码来源:ClusterMO.java

示例8: composeVncOptions

import com.vmware.vim25.OptionValue; //导入依赖的package包/类
public static OptionValue[] composeVncOptions(OptionValue[] optionsToMerge, boolean enableVnc, String vncPassword, int vncPort, String keyboardLayout) {

        int numOptions = 3;
        boolean needKeyboardSetup = false;
        if (keyboardLayout != null && !keyboardLayout.isEmpty()) {
            numOptions++;
            needKeyboardSetup = true;
        }

        if (optionsToMerge != null)
            numOptions += optionsToMerge.length;

        OptionValue[] options = new OptionValue[numOptions];
        int i = 0;
        if (optionsToMerge != null) {
            for (int j = 0; j < optionsToMerge.length; j++)
                options[i++] = optionsToMerge[j];
        }

        options[i] = new OptionValue();
        options[i].setKey("RemoteDisplay.vnc.enabled");
        options[i++].setValue(enableVnc ? "true" : "false");

        options[i] = new OptionValue();
        options[i].setKey("RemoteDisplay.vnc.password");
        options[i++].setValue(vncPassword);

        options[i] = new OptionValue();
        options[i].setKey("RemoteDisplay.vnc.port");
        options[i++].setValue("" + vncPort);

        if (needKeyboardSetup) {
            options[i] = new OptionValue();
            options[i].setKey("RemoteDisplay.vnc.keymap");
            options[i++].setValue(keyboardLayout);
        }

        return options;
    } 
开发者ID:apache,项目名称:cloudstack,代码行数:40,代码来源:VmwareHelper.java

示例9: configCustomExtraOption

import com.vmware.vim25.OptionValue; //导入依赖的package包/类
private static void configCustomExtraOption(List<OptionValue> extraOptions, VirtualMachineTO vmSpec) {
    // we no longer to validation anymore
    for (Map.Entry<String, String> entry : vmSpec.getDetails().entrySet()) {
        OptionValue newVal = new OptionValue();
        newVal.setKey(entry.getKey());
        newVal.setValue(entry.getValue());
        extraOptions.add(newVal);
    }
} 
开发者ID:apache,项目名称:cloudstack,代码行数:10,代码来源:VmwareResource.java

示例10: populateSnapshotLimitValue

import com.vmware.vim25.OptionValue; //导入依赖的package包/类
private OptionValue populateSnapshotLimitValue(String snapshotLimitValue) {
    OptionValue ov = new OptionValue();
    ov.setKey(SNAPSHOT_LIMIT_CONFIG_STRING);
    ov.setValue(snapshotLimitValue);
    return ov;
} 
开发者ID:vmware,项目名称:photon-model,代码行数:7,代码来源:InstanceClient.java

示例11: getVmVncPortsOnHost

import com.vmware.vim25.OptionValue; //导入依赖的package包/类
public HashMap<String, Integer> getVmVncPortsOnHost() throws Exception {

        int key = getCustomFieldKey("VirtualMachine", CustomFieldConstants.CLOUD_VM_INTERNAL_NAME);
        if (key == 0) {
            s_logger.warn("Custom field " + CustomFieldConstants.CLOUD_VM_INTERNAL_NAME + " is not registered ?!");
        }

        ObjectContent[] ocs = getVmPropertiesOnHyperHost(new String[] {"name", "config.extraConfig[\"RemoteDisplay.vnc.port\"]", "value[" + key + "]"});

        HashMap<String, Integer> portInfo = new HashMap<String, Integer>();
        if (ocs != null && ocs.length > 0) {
            for (ObjectContent oc : ocs) {
                List<DynamicProperty> objProps = oc.getPropSet();
                if (objProps != null) {
                    String vmName = null;
                    String value = null;
                    String vmInternalCSName = null;
                    for (DynamicProperty objProp : objProps) {
                        if (objProp.getName().equals("name")) {
                            vmName = (String)objProp.getVal();
                        } else if (objProp.getName().startsWith("value[")) {
                            if (objProp.getVal() != null)
                                vmInternalCSName = ((CustomFieldStringValue)objProp.getVal()).getValue();
                        } else {
                            OptionValue optValue = (OptionValue)objProp.getVal();
                            value = (String)optValue.getValue();
                        }
                    }

                    if (vmInternalCSName != null && isUserVMInternalCSName(vmInternalCSName))
                        vmName = vmInternalCSName;

                    if (vmName != null && value != null) {
                        portInfo.put(vmName, Integer.parseInt(value));
                    }
                }
            }
        }

        return portInfo;
    } 
开发者ID:apache,项目名称:cloudstack,代码行数:42,代码来源:HostMO.java

示例12: configureVnc

import com.vmware.vim25.OptionValue; //导入依赖的package包/类
protected OptionValue[] configureVnc(OptionValue[] optionsToMerge, VmwareHypervisorHost hyperHost, String vmName, String vncPassword, String keyboardLayout) throws Exception {

        VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(vmName);

        VmwareManager mgr = hyperHost.getContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME);
        if (!mgr.beginExclusiveOperation(600))
            throw new Exception("Unable to begin exclusive operation, lock time out");

        try {
            int maxVncPorts = 64;
            int vncPort = 0;
            Random random = new Random();

            HostMO vmOwnerHost = vmMo.getRunningHost();

            ManagedObjectReference morParent = vmOwnerHost.getParentMor();
            HashMap<String, Integer> portInfo;
            if (morParent.getType().equalsIgnoreCase("ClusterComputeResource")) {
                ClusterMO clusterMo = new ClusterMO(vmOwnerHost.getContext(), morParent);
                portInfo = clusterMo.getVmVncPortsOnCluster();
            } else {
                portInfo = vmOwnerHost.getVmVncPortsOnHost();
            }

            // allocate first at 5900 - 5964 range
            Collection<Integer> existingPorts = portInfo.values();
            int val = random.nextInt(maxVncPorts);
            int startVal = val;
            do {
                if (!existingPorts.contains(5900 + val)) {
                    vncPort = 5900 + val;
                    break;
                }

                val = (++val) % maxVncPorts;
            } while (val != startVal);

            if (vncPort == 0) {
                s_logger.info("we've run out of range for ports between 5900-5964 for the cluster, we will try port range at 59000-60000");

                Pair<Integer, Integer> additionalRange = mgr.getAddiionalVncPortRange();
                maxVncPorts = additionalRange.second();
                val = random.nextInt(maxVncPorts);
                startVal = val;
                do {
                    if (!existingPorts.contains(additionalRange.first() + val)) {
                        vncPort = additionalRange.first() + val;
                        break;
                    }

                    val = (++val) % maxVncPorts;
                } while (val != startVal);
            }

            if (vncPort == 0) {
                throw new Exception("Unable to find an available VNC port on host");
            }

            if (s_logger.isInfoEnabled()) {
                s_logger.info("Configure VNC port for VM " + vmName + ", port: " + vncPort + ", host: " + vmOwnerHost.getHyperHostName());
            }

            return VmwareHelper.composeVncOptions(optionsToMerge, true, vncPassword, vncPort, keyboardLayout);
        } finally {
            try {
                mgr.endExclusiveOperation();
            } catch (Throwable e) {
                assert (false);
                s_logger.error("Unexpected exception ", e);
            }
        }
    } 
开发者ID:apache,项目名称:cloudstack,代码行数:73,代码来源:VmwareResource.java

示例13: getSetting

import com.vmware.vim25.OptionValue; //导入依赖的package包/类
List<OptionValue> getSetting(); 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:2,代码来源:OptionManagerApi.java

示例14: queryOptions

import com.vmware.vim25.OptionValue; //导入依赖的package包/类
List<OptionValue> queryOptions(String name) throws InvalidName, RuntimeFault, RemoteException; 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:2,代码来源:OptionManagerApi.java

示例15: updateOptions

import com.vmware.vim25.OptionValue; //导入依赖的package包/类
void updateOptions(List<OptionValue> changedValue) throws InvalidName, RuntimeFault, RemoteException; 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:2,代码来源:OptionManagerApi.java

本文标签属性:

示例:示例英文

代码:代码编程

java:javascript什么意思

OptionValue:OptionValue

上一篇:Java DigitalChannel类代码示例(javadigitalchannel类代码示例汇总)
下一篇:龙岗在哪个省哪个城市(龙岗区是哪个省哪个市)

为您推荐