Package com.vmware.vim25

Examples of com.vmware.vim25.OptionValue


  }


  public void vncDeActivateVm(VirtualMachine newVm) throws InvalidName, VmConfigFault, DuplicateName, TaskInProgress, FileFault, InvalidState, ConcurrentAccess, InvalidDatastore, InsufficientResourcesFault, RuntimeFault, RemoteException, InterruptedException {
    OptionValue currentExtraConfig[]=newVm.getConfig().getExtraConfig();

    //Remove extra config
    // http://communities.vmware.com/message/1229409
   
    OptionValue newExtraConfig[];
   
    //determine the number of RemoteDisplay flags
    int counter=0;
   
   
    for (int i=0; i <currentExtraConfig.length;  i++)
    {
      if (currentExtraConfig[i].getKey().startsWith("RemoteDisplay.vnc")) {
        counter++;
      }
//      System.out.println(currentExtraConfig[i].getKey());
    }

    newExtraConfig=new OptionValue[currentExtraConfig.length-counter];

    int newcounter=0;
    for (int i=0; i <currentExtraConfig.length;  i++)
    {
      if (!currentExtraConfig[i].getKey().startsWith("RemoteDisplay.vnc")) {
        newExtraConfig[newcounter]=currentExtraConfig[i];
//        System.out.println(newExtraConfig[newcounter].getKey());

        newcounter++;
      }
    }


    OptionValue vnc1=new OptionValue() ;vnc1.setKey("RemoteDisplay.vnc.enabled");vnc1.setValue("FALSE");
    OptionValue vnc2=new OptionValue() ;vnc2.setKey("RemoteDisplay.vnc.password");vnc2.setValue("");
    OptionValue vnc3=new OptionValue() ;vnc3.setKey("RemoteDisplay.vnc.port");vnc3.setValue("0");
    OptionValue vnc4=new OptionValue() ;vnc4.setKey("RemoteDisplay.vnc.key");vnc4.setValue("");

    OptionValue[] extraConfig= { vnc1, vnc2, vnc3, vnc4 };

    VirtualMachineConfigSpec vmConfigSpec2 = new VirtualMachineConfigSpec();
    vmConfigSpec2.setExtraConfig(extraConfig);
View Full Code Here


    // Extraconfig gebruik : http://sourceforge.net/projects/vijava/forums/forum/826592/topic/3756870?message=8491628
    //     RemoteDisplay.vnc.enabled = "TRUE"
    //     RemoteDisplay.vnc.password = "your_password"
    //     RemoteDisplay.vnc.port = "5900"

    OptionValue vnc1=new OptionValue() ;vnc1.setKey("RemoteDisplay.vnc.enabled");vnc1.setValue("TRUE");
    OptionValue vnc2=new OptionValue() ;vnc2.setKey("RemoteDisplay.vnc.password");vnc2.setValue(vncPassword);
    OptionValue vnc3=new OptionValue() ;vnc3.setKey("RemoteDisplay.vnc.port");vnc3.setValue(String.valueOf(vncPort));
    OptionValue[] extraConfig= { vnc1, vnc2, vnc3 };

    // Need to get the old extraconfig + add new stuff
   
    // Default VNC is not enabled in ESX
View Full Code Here

        }

        if (!nicName.toLowerCase().equals(interfaceName.toLowerCase())) {
          if (nicType=="e1000") {
            System.err.println("Disabling pxe on "+nicName+"-"+interfaceName);
            OptionValue nicSpec=new OptionValue() ;nicSpec.setKey("ethernet"+(e1000Counter-1)+".opromsize");nicSpec.setValue("0");
            extraConfig.add(nicSpec);

          }
         
          //Spec -> ethernet<counter-1>.opromsize=0
         
        } else {
         
        }

      }
    }

    OptionValue optionConfig[]= extraConfig.toArray(new OptionValue[1]);
   
    vmConfigSpec.setExtraConfig(optionConfig);


    Task pxetask =   vm.reconfigVM_Task(vmConfigSpec);
View Full Code Here

    //bios.bootDeviceClasses
    //http://download3.vmware.com/sample_code/Perl/VMBootOrder.html
    // "allow:cd,hd,net"
   
    OptionValue bootOptions=new OptionValue() ;bootOptions.setKey("bios.bootDeviceClasses");bootOptions.setValue(order);
    OptionValue[] bootOptionsConfig= bootOptions };

    VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
    vmConfigSpec.setExtraConfig(bootOptionsConfig);
View Full Code Here

     * @return ovf descriptor xml as string data.
     */
    public String exportOvf()
    {
        OvfFile[] ovfFiles = new OvfFile[0];
        OvfCreateDescriptorParams ovfDescParams = new OvfCreateDescriptorParams();
        ovfDescParams.setOvfFiles(ovfFiles);
        try {
            OvfCreateDescriptorResult ovfCreateDescriptorResult =
                conn_.getServiceInstance().getOvfManager().createDescriptor
                (vm_, ovfDescParams);
            return ovfCreateDescriptorResult.getOvfDescriptor();
View Full Code Here

    {
        OvfFile[] ovfFiles = new OvfFile[0];
        OvfCreateDescriptorParams ovfDescParams = new OvfCreateDescriptorParams();
        ovfDescParams.setOvfFiles(ovfFiles);
        try {
            OvfCreateDescriptorResult ovfCreateDescriptorResult =
                conn_.getServiceInstance().getOvfManager().createDescriptor
                (vm_, ovfDescParams);
            return ovfCreateDescriptorResult.getOvfDescriptor();
        } catch (Exception e) { logger_.warning(Utility.toString(e)); return null; }
    }
View Full Code Here

            isScsi = false;
            ctrl = new VirtualIDEController();
            break;
        case BUSLOGIC:
            isScsi = true;
            ctrl = new VirtualBusLogicController();
            break;
        case LSILOGIC:
            isScsi = true;
            ctrl = new VirtualLsiLogicController();
            break;
View Full Code Here

    {
        VirtualDeviceConfigSpec controllerSpec =
            new VirtualDeviceConfigSpec();
        controllerSpec.setOperation(VirtualDeviceConfigSpecOperation.add);

        VirtualController ctrl = null;
        boolean isScsi = true;
       
        switch(type_) {
        case IDE:
            isScsi = false;
            ctrl = new VirtualIDEController();
            break;
        case BUSLOGIC:
            isScsi = true;
            ctrl = new VirtualBusLogicController();
            break;
        case LSILOGIC:
            isScsi = true;
            ctrl = new VirtualLsiLogicController();
            break;
        case LSILOGICSAS:
            isScsi = true;
            ctrl = new VirtualLsiLogicSASController();
            break;
        default:
            return null;
        }

        ctrl.setKey(ckey_);
        ctrl.setBusNumber(busNumber_);
        if (isScsi) {
            assert ctrl instanceof VirtualSCSIController;
            VirtualSCSIController scsiCtrl = (VirtualSCSIController) ctrl;
            scsiCtrl.setSharedBus(VirtualSCSISharing.noSharing);
        }
View Full Code Here

     * @param ckey key of the controller device.
     * @return Adapter type. This does not return null.
     */
    private AdapterType getAdapterType(int ckey)
    {
        VirtualDevice vd = searchVirtualDeviceWithKey(ckey);
        if (vd == null) {
            return AdapterType.UNKNOWN;
        }
        assert vd.getKey() == ckey;

        AdapterType ret = AdapterType.UNKNOWN;
        if (vd instanceof VirtualIDEController) {
            ret = AdapterType.IDE;
        } else if (vd instanceof VirtualBusLogicController) {
View Full Code Here

     * @param ckey key of the controller device.
     * @return busNumber in success, or -1 in failure.
     */
    private int getBusNumber(int ckey)
    {
        VirtualDevice vd = searchVirtualDeviceWithKey(ckey);
        if (vd == null) { return -1; }

        if (vd instanceof VirtualController) {
            return ((VirtualController) vd).getBusNumber();
        } else {
View Full Code Here

TOP

Related Classes of com.vmware.vim25.OptionValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.