Package com.vmware.vim25.mo

Examples of com.vmware.vim25.mo.Task


  public void destroyVm(VirtualMachine existingVm) throws TaskInProgress, InvalidState, RuntimeFault, RemoteException, InterruptedException {

    String vmName=existingVm.getName();

    //Other strategy is to suspend it and rename the machine (so we still have it)
    Task destroytask=existingVm.destroy_Task();
    destroytask.waitForTask();
    System.out.println("vm:" + vmName + " is destroyed");

  }
View Full Code Here


  }

  public void powerOnVm(VirtualMachine newVm) throws VmConfigFault, TaskInProgress, FileFault, InvalidState, InsufficientResourcesFault, RuntimeFault, RemoteException, InterruptedException {
    String vmName=newVm.getName();

    Task powerOnTask=newVm.powerOnVM_Task(null);
    powerOnTask.waitForTask();
    System.out.println("vm"+vmName+" is powered on");

  }
View Full Code Here

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

    VirtualMachineConfigSpec vmConfigSpec2 = new VirtualMachineConfigSpec();
    vmConfigSpec2.setExtraConfig(extraConfig);

    Task vnctask =   newVm.reconfigVM_Task(vmConfigSpec2);
    String vncresult=    vnctask.waitForTask();

    if(vncresult == Task.SUCCESS)
    {
      System.out.println("VNC deactivated Sucessfully");
View Full Code Here

    VirtualMachineConfigSpec vmConfigSpec2 = new VirtualMachineConfigSpec();
    vmConfigSpec2.setExtraConfig(extraConfig);
 

    Task vnctask =   newVm.reconfigVM_Task(vmConfigSpec2);
    String vncresult=    vnctask.waitForTask();

    if(vncresult == Task.SUCCESS)
    {
      System.out.println("VNC Set Sucessfully");
View Full Code Here

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


    Task pxetask =   vm.reconfigVM_Task(vmConfigSpec);
    String pxeresult=    pxetask.waitForTask();

    if(pxeresult == Task.SUCCESS)
    {
      System.out.println("Pxe Set Sucessfully");
View Full Code Here

    OptionValue[] bootOptionsConfig= bootOptions };

    VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
    vmConfigSpec.setExtraConfig(bootOptionsConfig);

    Task bootOptionstask =   vm.reconfigVM_Task(vmConfigSpec);
    String bootOptionsResult=    bootOptionstask.waitForTask();

    if(bootOptionsResult == Task.SUCCESS)
    {
      System.out.println("Boot order Set Sucessfully");
View Full Code Here

    vmSpec.setFiles(vmfi);

    // call the createVM_Task method on the vm folder
    // TOO: null, host ?
    Task task = vmFolder.createVM_Task(vmSpec, rp, null);
    String result= task.waitForTask();
    //    String result = task.waitForMe();  


    VirtualMachine newVm=null;

    if(result == Task.SUCCESS)
    {
      System.out.println("VM Created Sucessfully");

      //Search for it and start it if requested
      //TODO powerOnVM_Task (null) =!! null = host , maar was is die host?

      newVm = (VirtualMachine) new InventoryNavigator(rootFolder).searchManagedEntity("VirtualMachine",vmName);
    } else
    {
      System.out.println("VM could not be created. Error:");
      if (task.getTaskInfo() != null && task.getTaskInfo().getError() != null)
      {          
        System.out.println("Task detailed error :" + task.getTaskInfo().getError().getLocalizedMessage());
      }
      System.exit(-1);
    }   
   
    return newVm;
View Full Code Here

      VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();

      vmConfigSpec.setDeviceChange(new VirtualDeviceConfigSpec[]{cdSpec});

      System.err.println("Mounting cdrom"+vsphereDataStoreName+vmCdromIsoPath);
      Task cdtask = newVm.reconfigVM_Task(vmConfigSpec);
      String cdresult=cdtask.waitForTask();

      if(cdresult == Task.SUCCESS)
      {
        System.out.println("Cdrom Created Sucessfully");
View Full Code Here

    VirtualMachineBootOptions bootoptions= new VirtualMachineBootOptions();
    bootoptions.setEnterBIOSSetup(flag);

    vmConfigSpec.setBootOptions(bootoptions);

    Task biostask = newVm.reconfigVM_Task(vmConfigSpec);
    String biosresult=biostask.waitForTask();

    if(biosresult == Task.SUCCESS)
    {
      System.out.println("Enter Bios Set set to "+flag);
View Full Code Here

     * @return changed block information as a bitmap data.
     */
    public VmdkBitmap getChangedBlocksOfDisk
        (VmdkInfo vmdkInfo, String baseChangeId)
    {
        final VirtualMachine vm = vmm_.getVirtualMachine();
        final VirtualMachineSnapshot vmSnap = snapshot_;

        if (baseChangeId == null) {
            baseChangeId = "*";
        }

        logger_.info(vmdkInfo.toString());
        logger_.info(baseChangeId); /* debug */

        final long capacityInBytes = vmdkInfo.capacityInKB_ * 1024L;
       
        /* block size is fixed to 1MB currently */
        VmdkBitmap bmp = new VmdkBitmap(capacityInBytes, 1024 * 1024);
       
        boolean isNotChangedAtAll = false;
        try {
            long offset = 0;
            DiskChangeInfo dci = null;
            do {
                dci = vm.queryChangedDiskAreas
                    (vmSnap, vmdkInfo.key_, offset, baseChangeId);

                if (offset == 0 && (dci.changedArea == null)) {
                    /*
                      ChangeId is not null and DiskChangeInfo.changedArea is null,
View Full Code Here

TOP

Related Classes of com.vmware.vim25.mo.Task

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.