Package com.vmware.vim25.mo

Examples of com.vmware.vim25.mo.Task


    {
      System.out.println("Invlaid device type [disk|cd]");
      return;
    }
   
    Task task = vm.reconfigVM_Task(vmConfigSpec);
    task.waitForMe();
  }
View Full Code Here


    String result = null;
    if(nicSpec!=null)
    {
      vmConfigSpec.setDeviceChange(
          new VirtualDeviceConfigSpec []{nicSpec});
      Task task = vm.reconfigVM_Task(vmConfigSpec);
      result = task.waitForMe();
    }

    if(result==Task.SUCCESS)
    {
      System.out.println("Done with NIC for VM:" + vmname);
View Full Code Here

      vm.rebootGuest();
      System.out.println(vmname + " guest OS rebooted");
    }
    else if("poweron".equalsIgnoreCase(op))
    {
      Task task = vm.powerOnVM_Task(null);
      if(task.waitForMe()==Task.SUCCESS)
      {
        System.out.println(vmname + " powered on");
      }
    }
    else if("poweroff".equalsIgnoreCase(op))
    {
      Task task = vm.powerOffVM_Task();
      if(task.waitForMe()==Task.SUCCESS)
      {
        System.out.println(vmname + " powered off");
      }
    }
    else if("reset".equalsIgnoreCase(op))
    {
      Task task = vm.resetVM_Task();
      if(task.waitForMe()==Task.SUCCESS)
      {
        System.out.println(vmname + " reset");
      }
    }
    else if("standby".equalsIgnoreCase(op))
    {
      vm.standbyGuest();
      System.out.println(vmname + " guest OS stoodby");
    }
    else if("suspend".equalsIgnoreCase(op))
    {
      Task task = vm.suspendVM_Task();
      if(task.waitForMe()==Task.SUCCESS)
      {
        System.out.println(vmname + " suspended");
      }
    }
    else if("shutdown".equalsIgnoreCase(op))
    {
      Task task = vm.suspendVM_Task();
      if(task.waitForMe()==Task.SUCCESS)
      {
        System.out.println(vmname + " suspended");
      }
    }
    else
View Full Code Here

    {
      System.out.println("Invlaid device type [disk|cd]");
      return;
    }
   
    Task task = vm.reconfigVM_Task(vmConfigSpec);
    task.waitForMe();
  }
View Full Code Here

    else
    {
      throw new RuntimeException("No free IDE controller for addtional CD Drive.");
    }
   
    Task task = vm.reconfigVM_Task(config);
    task.waitForTask();
  }
View Full Code Here

    diskSpec.setDevice(disk);
    VirtualDeviceConfigSpec vdiskSpec = diskSpec;
    VirtualDeviceConfigSpec [] vdiskSpecArray = {vdiskSpec};        

    vmConfigSpec.setDeviceChange(vdiskSpecArray);
    Task task = vm.reconfigVM_Task(vmConfigSpec);

    task.waitForTask(200, 100);
  }
View Full Code Here

    disk.setKey(-100);

    diskSpec.setOperation(VirtualDeviceConfigSpecOperation.add);          
    diskSpec.setDevice(disk);                
   
    Task task = vm.reconfigVM_Task(vmConfigSpec);

    task.waitForTask(200, 100);
  }
View Full Code Here

    VirtualDeviceConfigSpec nicSpec = createNicSpec(type, networkName, macAddress, wakeOnLan, startConnected, configTarget);
   
    VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
    vmConfigSpec.setDeviceChange(new VirtualDeviceConfigSpec []{nicSpec});
    Task task = vm.reconfigVM_Task(vmConfigSpec);

    task.waitForTask(200, 100);
  }
View Full Code Here

      config.deviceChange = new VirtualDeviceConfigSpec[configSpecList.size()];
      for(int i=0; i< configSpecList.size(); i++)
      {
        config.deviceChange[i] = configSpecList.get(i);
      }
      Task task = vm.reconfigVM_Task(config);
      return task;
    }
    return null;
  }
View Full Code Here

  }



  public void powerOffVm(VirtualMachine existingVm) throws TaskInProgress, InvalidState, RuntimeFault, RemoteException, InterruptedException {
    Task task = existingVm.powerOffVM_Task();    
    task.waitForTask();
    System.out.println("vm:" + existingVm.getName() + " powered off.");   
  }
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.