Package com.vmware.vim25

Examples of com.vmware.vim25.VirtualMachineRelocateSpec


        assert (morFolder != null);
        assert (morResourcePool != null);
        assert (morDs != null);

        VirtualDisk[] independentDisks = getAllIndependentDiskDevice();
        VirtualMachineRelocateSpec rSpec = new VirtualMachineRelocateSpec();
        if (independentDisks.length > 0) {
            List<VirtualMachineRelocateSpecDiskLocator> diskLocator = new ArrayList<VirtualMachineRelocateSpecDiskLocator>(independentDisks.length);
            for (int i = 0; i < independentDisks.length; i++) {
                VirtualMachineRelocateSpecDiskLocator loc = new VirtualMachineRelocateSpecDiskLocator();
                loc.setDatastore(morDs);
                loc.setDiskId(independentDisks[i].getKey());
                loc.setDiskMoveType(VirtualMachineRelocateDiskMoveOptions.MOVE_ALL_DISK_BACKINGS_AND_DISALLOW_SHARING.value());
                diskLocator.add(loc);
            }

            rSpec.setDiskMoveType(VirtualMachineRelocateDiskMoveOptions.CREATE_NEW_CHILD_DISK_BACKING.value());
            rSpec.getDisk().addAll(diskLocator);
        } else {
            rSpec.setDiskMoveType(VirtualMachineRelocateDiskMoveOptions.CREATE_NEW_CHILD_DISK_BACKING.value());
        }
        rSpec.setPool(morResourcePool);

        VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec();
        cloneSpec.setPowerOn(false);
        cloneSpec.setTemplate(false);
        cloneSpec.setLocation(rSpec);
View Full Code Here


        }
        return false;
    }

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

  public boolean createFullClone(String cloneName, ManagedObjectReference morFolder, ManagedObjectReference morResourcePool,
    ManagedObjectReference morDs) throws Exception {

       VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec();
       VirtualMachineRelocateSpec relocSpec = new VirtualMachineRelocateSpec();
       cloneSpec.setLocation(relocSpec);
       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);
View Full Code Here

    assert(morFolder != null);
    assert(morResourcePool != null);
    assert(morDs != null);

    VirtualDisk[] independentDisks = getAllIndependentDiskDevice();
        VirtualMachineRelocateSpec rSpec = new VirtualMachineRelocateSpec();
        if(independentDisks.length > 0) {
            List<VirtualMachineRelocateSpecDiskLocator> diskLocator = new ArrayList<VirtualMachineRelocateSpecDiskLocator>(independentDisks.length);
            for(int i = 0; i < independentDisks.length; i++) {
                VirtualMachineRelocateSpecDiskLocator loc = new VirtualMachineRelocateSpecDiskLocator();
              loc.setDatastore(morDs);
              loc.setDiskId(independentDisks[i].getKey());
              loc.setDiskMoveType(VirtualMachineRelocateDiskMoveOptions.MOVE_ALL_DISK_BACKINGS_AND_DISALLOW_SHARING.value());
              diskLocator.add(loc);
            }

            rSpec.setDiskMoveType(VirtualMachineRelocateDiskMoveOptions.CREATE_NEW_CHILD_DISK_BACKING.value());
            rSpec.getDisk().addAll(diskLocator);
        } else {
          rSpec.setDiskMoveType(VirtualMachineRelocateDiskMoveOptions.CREATE_NEW_CHILD_DISK_BACKING.value());
        }
        rSpec.setPool(morResourcePool);

        VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec();
        cloneSpec.setPowerOn(false);
        cloneSpec.setTemplate(false);
        cloneSpec.setLocation(rSpec);
View Full Code Here

   
    return false;
  }
 
  public boolean relocate(ManagedObjectReference morTargetHost) throws Exception {
      VirtualMachineRelocateSpec relocateSpec = new VirtualMachineRelocateSpec();
      relocateSpec.setHost(morTargetHost);
     
        ManagedObjectReference morTask = _context.getService().relocateVM_Task(_mor,
            relocateSpec, null);
     
        String result = _context.getServiceUtil().waitForTask(morTask);
View Full Code Here

 
  public boolean createFullClone(String cloneName, ManagedObjectReference morFolder, ManagedObjectReference morResourcePool,
    ManagedObjectReference morDs) throws Exception {
   
       VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec();
       VirtualMachineRelocateSpec relocSpec = new VirtualMachineRelocateSpec();
       cloneSpec.setLocation(relocSpec);
       cloneSpec.setPowerOn(false);
       cloneSpec.setTemplate(false);
    
       relocSpec.setDatastore(morDs);
       relocSpec.setPool(morResourcePool);
        ManagedObjectReference morTask = _context.getService().cloneVM_Task(_mor, morFolder, cloneName, cloneSpec);
       
    String result = _context.getServiceUtil().waitForTask(morTask);
    if(result.equals("sucess")) {
      _context.waitForTaskProgressDone(morTask);
View Full Code Here

    assert(morFolder != null);
    assert(morResourcePool != null);
    assert(morDs != null);
   
    VirtualDisk[] independentDisks = getAllIndependentDiskDevice();
        VirtualMachineRelocateSpec rSpec = new VirtualMachineRelocateSpec();
        if(independentDisks.length > 0) {
            VirtualMachineRelocateSpecDiskLocator[] diskLocator = new VirtualMachineRelocateSpecDiskLocator[independentDisks.length];
            for(int i = 0; i < diskLocator.length; i++) {
              diskLocator[i] = new VirtualMachineRelocateSpecDiskLocator();
              diskLocator[i].setDatastore(morDs);
              diskLocator[i].setDiskId(independentDisks[i].getKey());
              diskLocator[i].setDiskMoveType(VirtualMachineRelocateDiskMoveOptions._moveAllDiskBackingsAndDisallowSharing);
            }
           
            rSpec.setDiskMoveType(VirtualMachineRelocateDiskMoveOptions._createNewChildDiskBacking);
            rSpec.setDisk(diskLocator);
        } else {
          rSpec.setDiskMoveType(VirtualMachineRelocateDiskMoveOptions._createNewChildDiskBacking);
        }
        rSpec.setPool(morResourcePool);
       
        VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec();
        cloneSpec.setPowerOn(false);
        cloneSpec.setTemplate(false);
        cloneSpec.setLocation(rSpec);
View Full Code Here

      
       ManagedObjectReference morPool = new ManagedObjectReference();
       morPool.setType("ResourcePool");
       morPool.set_value("resgroup-41");
      
       VirtualMachineRelocateSpec relocSpec = new VirtualMachineRelocateSpec();
       cloneSpec.setLocation(relocSpec);
       cloneSpec.setPowerOn(false);
       cloneSpec.setTemplate(false);
      
       relocSpec.setDatastore(morDatastore);
       relocSpec.setHost(morHost);
       relocSpec.setPool(morPool);
      
       ManagedObjectReference morTemplate = new ManagedObjectReference();
       morTemplate.setType("VirtualMachine");
       morTemplate.set_value("vm-76");
      
View Full Code Here

        }
        return false;
    }

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

  public boolean createFullClone(String cloneName, ManagedObjectReference morFolder, ManagedObjectReference morResourcePool,
    ManagedObjectReference morDs) throws Exception {

       VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec();
       VirtualMachineRelocateSpec relocSpec = new VirtualMachineRelocateSpec();
       cloneSpec.setLocation(relocSpec);
       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);
View Full Code Here

TOP

Related Classes of com.vmware.vim25.VirtualMachineRelocateSpec

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.