Package com.vmware.vim25

Examples of com.vmware.vim25.ManagedObjectReference


        }
        return false;
    }

    public boolean changeHost(VirtualMachineRelocateSpec relocateSpec) throws Exception {
        ManagedObjectReference morTask = _context.getService().relocateVMTask(_mor, relocateSpec, VirtualMachineMovePriority.DEFAULT_PRIORITY);
        boolean result = _context.getVimClient().waitForTask(morTask);
        if (result) {
            _context.waitForTaskProgressDone(morTask);
            return true;
        } else {
View Full Code Here


  public boolean relocate(ManagedObjectReference morTargetHost) throws Exception {
      VirtualMachineRelocateSpec relocateSpec = new VirtualMachineRelocateSpec();
      relocateSpec.setHost(morTargetHost);

        ManagedObjectReference morTask = _context.getService().relocateVMTask(_mor,
            relocateSpec, null);

        boolean result = _context.getVimClient().waitForTask(morTask);
        if(result) {
            _context.waitForTaskProgressDone(morTask);
View Full Code Here

  }

  public boolean createSnapshot(String snapshotName, String snapshotDescription,
    boolean dumpMemory, boolean quiesce) throws Exception {

    ManagedObjectReference morTask = _context.getService().createSnapshotTask(_mor, snapshotName,
      snapshotDescription, dumpMemory, quiesce);

    boolean result = _context.getVimClient().waitForTask(morTask);
    if(result) {
      _context.waitForTaskProgressDone(morTask);

      ManagedObjectReference morSnapshot = null;
      // We still need to wait until the object appear in vCenter
      long startTick = System.currentTimeMillis();
      while(System.currentTimeMillis() - startTick < 10000) {
        morSnapshot = getSnapshotMor(snapshotName);
        if(morSnapshot != null) {
View Full Code Here

    return false;
  }

  public boolean removeSnapshot(String snapshotName, boolean removeChildren) throws Exception {
    ManagedObjectReference morSnapshot = getSnapshotMor(snapshotName);
    if(morSnapshot == null) {
      s_logger.warn("Unable to find snapshot: " + snapshotName);
      return false;
    }

    ManagedObjectReference morTask = _context.getService().removeSnapshotTask(morSnapshot, removeChildren, true);
    boolean result = _context.getVimClient().waitForTask(morTask);
    if(result) {
      _context.waitForTaskProgressDone(morTask);
      return true;
    } else {
View Full Code Here

    return false;
  }

    public boolean revertToSnapshot(String snapshotName) throws Exception {
        ManagedObjectReference morSnapshot = getSnapshotMor(snapshotName);
        if (morSnapshot == null) {
            s_logger.warn("Unable to find snapshot: " + snapshotName);
            return false;
        }
        ManagedObjectReference morTask = _context.getService()
                .revertToSnapshotTask(morSnapshot, _mor, null);
        boolean result = _context.getVimClient().waitForTask(morTask);
        if (result) {
            _context.waitForTaskProgressDone(morTask);
            return true;
View Full Code Here

    VirtualMachineSnapshotInfo snapshotInfo = getSnapshotInfo();

    if(snapshotInfo != null && snapshotInfo.getRootSnapshotList() != null) {
      List<VirtualMachineSnapshotTree> tree = snapshotInfo.getRootSnapshotList();
      for(VirtualMachineSnapshotTree treeNode : tree) {
        ManagedObjectReference morTask = _context.getService().removeSnapshotTask(treeNode.getSnapshot(), true, true);
        boolean result = _context.getVimClient().waitForTask(morTask);
        if(result) {
          _context.waitForTaskProgressDone(morTask);
        } else {
              s_logger.error("VMware removeSnapshot_Task failed due to " + TaskMO.getTaskFailureInfo(_context, morTask));
View Full Code Here

       cloneSpec.setPowerOn(false);
       cloneSpec.setTemplate(false);

       relocSpec.setDatastore(morDs);
       relocSpec.setPool(morResourcePool);
        ManagedObjectReference morTask = _context.getService().cloneVMTask(_mor, morFolder, cloneName, cloneSpec);

    boolean result = _context.getVimClient().waitForTask(morTask);
    if(result) {
      _context.waitForTaskProgressDone(morTask);
      return true;
View Full Code Here

        cloneSpec.setPowerOn(false);
        cloneSpec.setTemplate(false);
        cloneSpec.setLocation(rSpec);
        cloneSpec.setSnapshot(morBaseSnapshot);

        ManagedObjectReference morTask = _context.getService().cloneVMTask(_mor, morFolder, cloneName, cloneSpec);

    boolean result = _context.getVimClient().waitForTask(morTask);
    if(result) {
      _context.waitForTaskProgressDone(morTask);
      return true;
View Full Code Here

  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;
View Full Code Here

    }
    return false;
  }

  public boolean configureVm(VirtualMachineConfigSpec vmConfigSpec) throws Exception {
      ManagedObjectReference morTask = _context.getService().reconfigVMTask(_mor, vmConfigSpec);

      boolean result = _context.getVimClient().waitForTask(morTask);
    if(result) {
      _context.waitForTaskProgressDone(morTask);
      return true;
View Full Code Here

TOP

Related Classes of com.vmware.vim25.ManagedObjectReference

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.